Page 1 of 1

ListViewItem Array

Posted: Mon Oct 02, 2006 12:21 pm
by dos mes
Hmm, it seems that I haven't been able to get an answer on other forums that are just for programming so I'm hoping someone can help me out here. I'm running a large operation that add's hundreds to thousands of items to a listview, however, in order to reduce lag and allow for usability, I've added a background worker to do the job. The only problem is that the background worker can't directly interact with the main thread, and I need to be able to create an array of listviewitems, so I can declare them in the BGW and then when it's work finishes, add them to the listview finally.

This is the code that I have now, but it doesn't allow me to do this:

Code: Select all

Dim FileChunk(10000) As New ListViewItem()
Dim ItemChunk(10000) As New ListViewItem()
Dim CrapChunk(10000) As New ListViewItem()
Any help on how I could create an array that would work like you'd imagine this one too would be greatly appreciated :)

Posted: Mon Oct 02, 2006 1:15 pm
by Patrickssj6
hmm...

I'll check arrays in a min.Would there be another way to do that?Like saving it to a temp.txt file?

Posted: Mon Oct 02, 2006 1:26 pm
by dos mes
I don't think that would be possible. I might be able to do that, but then it would just add wayy more time onto the already lengthly operation, because in most cases unfortunately, I will be needing even more than 10,000. It would be more like 100,000 - 1,000,000 items :(

Posted: Mon Oct 02, 2006 1:50 pm
by Patrickssj6
Care to explain for what?