I'm setting my first steps in C#, and I'm making a small application, based on a System.Windows.Forms.Form
, on which I've placed a simple button. When this button is clicked, I do something which takes quite some time and I would like to modify the Text
property of that button while the operation is taking place.
This is what I have done (don't laugh :-) ):
private void btn_STUFF_Click(object sender, EventArgs e)
{
string temp_Title = btn_STUFF.Text;
btn_STUFF.Text = "Busy";
this.Refresh();
this.Update();
this.Show();
string temp = Do_Something_Which_Takes_Quite_Some_Time();
txt_output.Text = temp;
btn_STUFF.Text = temp_Title;
}
Despite the Refresh()
, the Update()
and the Show()
I don't see my button mentioning the word "busy".
How can I force my application to refresh the attributes of the components on the form (as easy as possible, please) ?
Thanks in advance