This is a bad way to do things, but if you must try using
Application.DoEvents()
:
int i = 0;
private void Form1_Load(object sender, EventArgs e)
{
Form2 F = new Form2();
F.Show();
while (true)
{
i++;
textbox1.text = i.ToString();
Application.DoEvents();
}
}
Alternatively use
Task
:
int i = 0;
private void Form1_Load(object sender, EventArgs e)
{
Form2 F = new Form2();
F.Show();
Task.Factory.StartNew( () =>
{
i++;
textbox1.text = i.ToString();
});
}