I have following code:
Hide()
if(a > b)
{
label.Text = "a is greater than b";
Show();
Thread.Sleep(50000);
}
What i am trying to do is hide the winform as soon as app starts. If a>b at any point it will show the winform with that message in the label for 50 second and will hide again.
Also label is set to autosize = true;
Above code works but label is not showing any text? Also is this the right approch to show the winfor for sometime using thread sleep?
as above says, it is because the sleep, the UI does not have time to update it yet.
however, you do not have to use timer. DoEvents() gives it some time to update UI.
try