views:

75

answers:

2

I have a Winforms App (.NET 3.X) That runs a method in a class to process some data. The method periodically raises a StatusUpdate event with a count of the number of items processed. I have a ToolStripStatuslabel on the Form that i would like to update with the count. The problem is that status label never updates with this count until the process is complete. Below is the code from the status update event handler

toolStripStatusLabel.Text = e.Count.ToString(); statusStrip.Refresh();

I think the problem is that the Refresh event is not firing because the processing method is being called from within a Button press event. I think there is a way to force the Refresh to process but I do not remember what it is.

My only other solution is to execute the processing in it's own thread.

A: 

Have you tried calling refresh on the label itself ? toolStripStatusLabel.Refresh();

Richard Friend
Did not work...
JookyDFW
+1  A: 

Found the answer in another thread:

Call Application.DoEvents() after setting the label, but you should do all the work in a separate thread instead, so the user may close the window.

This is the command that I was thinking of...

JookyDFW