I would like to display a big directory (4000 files) in a ListView with icons fast in one second like Windows Explorer does without freezing my Form1 UI.
For it I am trying to make use of the BackGroundWorker to make my Form1 not being freezed while the files are being loaded.
I ran into following problem:
I am getting exceptions like that: InvalidOperationException Thread-Crosswise...
Cannot access ListView in another thread...
Cannot access ImageList in another thread...
This is what I tried: I asked a professional and he said it is an error / limitation in the free VS 2008 Express edition. I have to buy the Ultimate Edition to remove the limitation. I asked Microsoft Support on this too and they said also that I have to own the full version to fix that bug. Now I got the full version (Ultimate Version), but the bug still prevails.
I uninstalled already old version and re-installed Ultimate and re-created the same project. What is still wrong with it?
Another expert on expert-exchange said I have to get the Ultimate Edition and then invoke it. I invoked the listView1 and this worked with this bugfix code:
if (listView1_.InvokeRequired)
{
listView1_.Invoke(new MethodInvoker(delegate
{
listView1_.Items.Add("file");
}));
}
else
{
listView1_.Items.Add("file");
}
But the ImageList has no such invoke option. I found nothing understandable and satisfying for me to solve the ImageList problem in the same way unless I drop the icons which makes for me no sense. Any ideas?