In my windows forms application, I close one form and open another like this:
MyApp.MySecondForm frmInst = new MyApp.MySecondForm();
frmInst.Show();
this.Hide();
But before I open like this, I set label text in my first form because I want to inform the user that second form is loading.
Imagine second form’s loading takes 10 seconds, when I press the button in order to open the second button, the label text doesn’t get changed until the second form gets open. When I close the second form, I recall the first form and see that the text has changed.
Which way should I follow to set label text right after user clicks a button?
Thanks in advance.
You have to call the
Refresh()method beforefrmInst.Show(). Because the graphics will not refresh until the method is finished executing, unless you do it manually.