Simulating Keypress With Erode, India
  • 13 years ago

    Hi, I have been searching around the net to try and find out how to simulate keyboard key presses and all I have been able to come up with so far are VB6 examples. I want to try and do this with

    The bit of code I'm looking to use will do the following:

    1. Open up a webpage (which I have figured out ok)

    2. The webpage im loading is used to download a file and when you load the pages brings up the dialog box to either open the file, save it or cancel the download. What I want to do here is tab accross to the particular button I want to in this case the save button. Then I want it to simulate an return/enter button press.

     3. This will then open the browser box where I can choose where I want to put the file. As above I want to tab to the directory box and then add in the text for that and then tab to the save button and hit enter again.

    Anyway I probably went into more detail than needed but wanted to give you an idea of what I want the program to do.

    Has anyone got the keypress thing working in I'm sure it should be a simple thing but I have searched and cannot find the answer. Anyway I hope I have given enough information and hope somebody can point me in the right direction.


  • 13 years ago
    Use "SendKeys.Send(...)". You will have to read the help documentation for the method because some parameters (like tab keys) have to be enclosed in brackets, like SendKeys.Send({TAB}). These parameters may also be case-sensitive - I can't remember...
  • 13 years ago

    got that working ok, but went in a different direction and programmed it in c#, though from what I see the code is almost identical as it would have been in vb.

    thanks for replying.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Measuring programming progress by lines of code is like measuring aircraft building progress by weight.” - Bill Gates