My code is as :
main()
{
label1.Visible=true;
/* code that takes about 1-2 minutes to respond */
label1.Visible=false;
}
Now i am unable to display & hide that label.
How do I display and hide the label?
My code is as :
main()
{
label1.Visible=true;
/* code that takes about 1-2 minutes to respond */
label1.Visible=false;
}
Now i am unable to display & hide that label.
How do I display and hide the label?
It's because all work is done in one thread which is your UI
thread. Try performing the hard work in another thread asynchronously:
async void YourMethod()
{
label1.Visible=true;
await Task.Run(() => /* do the work */);
label1.Visible=false;
}
See Asynchronous Programming with Async and Await for more details.