Thursday, 29 August 2013

How to make Dynamic TextBox in C#

How to make Dynamic TextBox in C#

I have simple FormApplication script that contains button and some
TextBoxs. I want when click on button, one textbox shows some numbers. How
I can make that dynamic.
private void button1_Click(object sender, EventArgs e)
{
txt3.Text = "";
for (int i = 0; i <50; i++)
{
Random random = new Random();
int randomNumber = random.Next(100, 150);
txt3.Text = randomNumber.ToString();
}
}
Now it waits to loop finished and shows latest number. I want it shows
each number during loop in TextBox seperatly. Seems using Dynamic TextBox
is a bit hard, is there any other solution to show this numbers in main
form? Regards,

No comments:

Post a Comment