Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 += ".";
           }
       }

[ once4ever ]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...