[RESOLVED] Listview acting not normal.
Hello, I'm trying to add items to the listview, but ever time i add a icon the Listview freezes\blinks a white color for a millisecond.
A millisecond is not a lot, but when you add 5 items per second to the listview then all you see is a white shade blinking.
I tried slowing the thread down so it takes longer for it add the items still no luck.
Did it ever happen to you?
If so how did you resolve it?
Any suggestion will help.
Re: Listview acting not normal.
As always, it's situational. We can't tell you what you're doing wrong until we know how you're doing it.
I have a bunch of applications that I add icons to a ListView and never have a flashing problem.
Re: Listview acting not normal.
try adding your items to a list(of listviewitem) then adding the list in 1 go:
vb Code:
listview1.items.addrange(list.toarray)
Re: Listview acting not normal.
This is how i add my items.
Code:
Dim str As String = "TEST"
Dim itm As ListViewItem
itm = New ListViewItem(str)
itm.ImageIndex = 1
ListView1.Items.Add(itm)
Paul do mean that i have to replace the
ListView1.Items.Add(itm)
with
listview1.items.addrange(list.toarray)
Or no?
Re: Listview acting not normal.
vb Code:
dim items as new list(of listviewitem)
for x as integer = 1 to 100
Dim str As String = "TEST" & x.tostring
Dim itm As ListViewItem
itm = New ListViewItem(str)
itm.ImageIndex = 1
items.add(itm)
next
ListView1.Items.Addrange(items.toarray)
Re: Listview acting not normal.
Wow thank you Paul.
It works!
I have added rep :)