hamid Posted June 3, 2006 Posted June 3, 2006 i need code that create thread adn do somethings and when thread is runing add dot to a label and when threade done it change label.text to complete. (how can increase time of a thread in order good result?) this is my code: public delegate void MyDelegate(); private void button1_Click(object sender, EventArgs e) { Thread thstart = null; thstart = new Thread(new ThreadStart(this.loadall)); thstart.Start(); } public void loadall() { //do somethings that need long time changelabel(); } public void changelabel() { if (label1.InvokeRequired) { MyDelegate del = new MyDelegate(this.changelabel); Invoke(del); } else { label1.Text += "."; } } Quote [ once4ever ]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.