문제

I made a code that read each line in a richtextbox with a foreach.

foreach (string str in textBox3.Lines)
{                
    SendKeys.Send(str + " \n");
    SendKeys.Send("{ENTER}");
}

But the problem is that it crashes because of the many lines. So what I thought is to make a timer after the the Enter sendkey. I tried it with Thread.Sleep and all kind of things that I've searched on the internet, but with no result.

도움이 되었습니까?

해결책

Use SendWait instead of Send, it will not continue until the message has been processed by the receiver.

However, there are likely better ways to do what you want to do other than SendKeys, if you add more details of what you are trying to accomplish I can try and update this answer with other potentially better options.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top