4 Replies - 28816 Views - Last Post: 29 July 2008 - 08:25 PM Rate Topic: -----

#1 the_hangman  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 13
  • View blog
  • Posts: 602
  • Joined: 18-January 06

Simulating a key press

Posted 31 October 2006 - 11:12 AM

I need to simulate a key press in VB.Net
For instance if a person clicked a button, I would want it to simulate pressing the Y key.

Any tutorials or examples I could look at?
Is This A Good Question/Topic? 0
  • +

Replies To: Simulating a key press

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Simulating a key press

Posted 31 October 2006 - 12:21 PM

Sorry, but just for clarification, do you want to simulate a keypress (meaning no key has been pressed, but you wish to simulate it), or catch an event (like the depression of another key, or button on a form), and turn that event into the same action that pressing the Y key would perform (which is placing a Y on screen unless there is additional functionality)?
Was This Post Helpful? 0
  • +
  • -

#3 the_hangman  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 13
  • View blog
  • Posts: 602
  • Joined: 18-January 06

Re: Simulating a key press

Posted 31 October 2006 - 01:35 PM

no key has been pressed, but I wish to simulate it as though it has
Was This Post Helpful? 0
  • +
  • -

#4 TBoy2004  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-March 08

Re: Simulating a key press

Posted 29 July 2008 - 07:20 PM

View Postthe_hangman, on 31 Oct, 2006 - 01:35 PM, said:

no key has been pressed, but I wish to simulate it as though it has


I would like to get it also. Could anyone can help? Thanks!
Was This Post Helpful? 0
  • +
  • -

#5 DeCompile  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 301
  • Joined: 20-July 08

Re: Simulating a key press

Posted 29 July 2008 - 08:25 PM

You could try something like:

sendkeys.send("y")

Sendkeys works for most keys, doesn't seem to work completely with Num, Caps or Scroll Lock though.
Was This Post Helpful? 1

Page 1 of 1