Progress on Windows Form

  • Thread starter Thread starter Folke
  • Start date Start date
F

Folke

I'm doing a lengthy operation and would like to
update a textbox while working, but the tb gets updated
AFTER the operation is finished!
code:
foreach (PDEHeaderItem pi in _pdeHandler._pa)
{
txtInfile.Text += "X";
txtInfile.Invalidate();
txtInfile.Update();
...
 
Folke said:
I'm doing a lengthy operation and would like to
update a textbox while working, but the tb gets updated
AFTER the operation is finished!
code:
foreach (PDEHeaderItem pi in _pdeHandler._pa)
{
txtInfile.Text += "X";
txtInfile.Invalidate();
txtInfile.Update();

Your textbox should update when you call Update()... though you might have to call Update on the form itself rather than the text
box.

Another alternative is to use a thread to do the work, and post status updates using BeginInvoke.
 
Back
Top