Simple Thread Programming

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2010-05-06T19:27:37Z Indexed on 2010/05/06 19:38 UTC
Read the original article Hit count: 185

Filed under:
|
|

I have started to play with threads in c#, but need now help, here is my code:

public partial class Form1 : Form
{

    public Form1()
    {
        InitializeComponent();

        DoCount();

    }
    public void DoCount()
    {
        for (int i = 0; i < 100; i++)
        {
            objTextBox.Text = i.ToString();
            Thread.Sleep(100);
        }

    }
}

its a simple win forms with a textbox, i want to see the "counting", but as you see in my code, the textbox shows me 99, it count till 99 and then shows up.. i`ll think, i have to manage this in a new thread but dont know how!

© Stack Overflow or respective owner

Related posts about c#

Related posts about Windows