I want in this code in the any step label show the Number of that step. In the my code just show last number in the label!
I also Label.Invalidate() the done, but do not work.
private void button1_Click(object sender, EventArgs e)
{
int i = 0;
while (i<100)
{
i++;
label1.Text = string.Format("Step is :{0}", i);
System.Threading.Thread.Sleep(1000);
}
}
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.update.aspx
Invoke Update
after setting text, it will help you. But of course you should consider background threads.
label1.Text = string.Format("Step is :{0}", i);
label1.Update();
System.Threading.Thread.Sleep(1000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With