Solved

Sendkeys is waiting for the delay

Posted on 2008-10-22
4
1,167 Views
Last Modified: 2008-11-22
Hi, I'm using sendkeys to send 3 commands to a window.  The first sendkeys is sending a string which it is doing.  The 2nd send keys is sending the ENTER key which it is doing and finally the 3rd send keys is sending another string.  The problem is that the second sleep is not kicking in, so passes it the 1st string and then waits for 2 secs and then it passes the ENTER key and the 3rd string together.  I really can't see what the problem is.  Anyone that can help feel free to shout.
SendKeys.Send("A6UJ9A000R08")
System.Threading.Thread.Sleep(2000)
SendKeys.Send("{ENTER}")
System.Threading.Thread.Sleep(2000)
SendKeys.Send("TEST")

Open in new window

0
Comment
Question by:meteorelec
4 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 22780797
You could try SendWait() instead of Send():
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.sendwait.aspx

SendKeys. SendWait("A6UJ9A000R08")
System.Threading.Thread.Sleep(2000)
SendKeys. SendWait("{ENTER}")
System.Threading.Thread.Sleep(2000)
SendKeys. SendWait("TEST")

Open in new window

0
 
LVL 2

Author Comment

by:meteorelec
ID: 22783990
That worked brilliantly, once again thanks a million Idle Mind.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now