Thread and Invoke

hamid

Centurion
Joined
Jul 13, 2004
Messages
114
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:
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 += ".";
            }
        }
 
Back
Top