In WinForms, how do I force an immediate UI update from UI thread?
What I'm doing is roughly:
label.Text = "Please Wait..."
try
{
SomewhatLongRunningOperation();
}
catch(Exception e)
{
label.Text = "Error: " + e.Message;
return;
}
label.Text = "Success!";
Label text does not get set to "Please Wait..." before the operation.
I solved this using another thread for the operation, but it gets hairy and I'd like to simplify the code.