Threading, listViews, application breaking... help?
Hi. I have a problem, and don't have a clue how to solve it.
Application contains 1 form, with 3 ListView controls in it. First of them lists known file types with their current icons, the second one lists programs that are recommended for opening or editing files with extension you choose from the first ListView (displays icons too), while the third one displays all icons from the default program that opens files with the selected extension.
When I use the application by mouse clicking from time to time it works fine. But if I start clicking more often, or start to use keyboard, for example when I just hold the down button to go through first ListView, the application goes crazy. It starts drawing what it shouldn't draw, and doesn't draw what it should. Eventually it crashes, reporting error, allways in different place.
Offcourse, I fill second and third ListView in another thread. In the method listView1_SelectedIndexChanged i've tried to wait for the thread to finish, i've tried mutex synchronization... Nothing helps. I think that simple synchronization doesn't help when you work with forms.
Can someone help me? Does anyone know what is, and how to use Control.Invoke(delegate) method, and does it have anything to do with this?
|