SendKeys Problem

thrillos

New member
Joined
Nov 27, 2007
Messages
4
Programming Experience
3-5
Hi guys. I am new here and i am glad being a member of your community.

I am developing a project which in fact is a batch function for a client of mine.
The project is about the following:

I have a button on the windows form and a webbrowser control.
When i click the button, then a webpage runs in the webbrowser control, which converts another webpage in a word document. So, inevitably, an open/save/cancel dialog box appears and the user needs to press the save button there. But my client wants to make several word documents without being present at the time....Just presses the button, and the webpage runs with different id's everytime. So i need to press the save button automatically. And there begins my problem with SendKeys.Send()

I am using the following code (on the click event of the button):
--------------------------------------
Application.DoEvents()

Me.wbBrowser.Navigate("//localhost:3200/homesite_backup/makewordfile.aspx?idInteger=3223")

Application.DoEvents()
Sleep(3000)


SendKeys.Send("{TAB 3}")

SendKeys.Send("{ENTER}")
Application.DoEvents()
--------------------------------------

Although the first Send of the TABS works just fine, the second does absolutely nothing. It seems like the ENTER press does not work nevertheless.
I've tried SendKeys.Send("s") and SendKeys.Send("~") also, but nothing happens.

Any ideas ?
Thanks in advance for your help!
 
This may not solve it, but I had a similar problem some time ago in VB6. The issue was the the other application hadnt finished processing the TAB events before the ENTER was sent. So, as a suggestion, put a small delay after every SendKeys, and see if that helps. By small, I mean 50 or 100 milliseconds - something the system will cope with but the user will not see.
 
How can i set a delay in vb.net (not sleep...i know that)? All i could find while searching the internet was for C++ (SendKeys.Send("{DELAY=50}")), and that doesnt work for VB.
 
Try Sleep, there's no reason why it shouldnt have the same effect.
 
Back
Top