Hello, I'm currently making a new program, but it doesn't work. The program is supposed to write a string X times. On the form, there is 2 textboxes and 1 button, the first must contain a string and the second a number. When the user press the button (Start), it write the string that the user entered in a loop, until it reach the number that the user entered.
This is what I tried :
How can I fix that?
This is what I tried :
private void butRun_Click(object sender, EventArgs e)
{
string str = textBoxStr.Text;
int nb = int.Parse(textBoxNb.Text);
if (str != "")
{
while (nb !=0)
{
SendKeys.Send(str);
SendKeys.Send("{ENTER}");
Thread.Sleep(5000);
nb--;
}
}
else
{
MessageBox.Show("Invalid Data");
}
}
But when I run the application, it freeze my computer for 20 secondes and it doesnt work anything in notepad.How can I fix that?