When app runs, window turns white!!???

  • Thread starter Thread starter trint
  • Start date Start date
T

trint

This application has a for loop that calls a large function:
"foreach (string invoice in listBox2.Items)"

and causes the window to turn white and loose view of all control.
How can I keep this from happening?
Thanks,
Trint
 
Hi Trint,

If I understand your problem correctly the whiteness is caused by a busy
application not having the time to repaint the controls. To solve this
you could handle the foreach loop in a different thread, keeping the GUI
thread up to speed, or call Application.DoEvents() ever so often inside
your loop to handle any waiting events.
 
hi,

Just be aware that you should access the UI from the worker thread.

cheers,
 
Back
Top