Tuesday, November 16, 2010

How to make a VB program order a keyboard actions?

How can I make it so that my code orders a user to press a key?



As in, it order's him/her to press the B key.



Also, how do I make it so that it makes him/her click left click?How to make a VB program order a keyboard actions?
If you want to capture just the fact that the mouse was clicked, you listen for the click event in a form or a control. The click event is fired if the form or control was clicked.



If you want to force someone to enter a specific character, you can use a boolean, a while and a prompt.



Dim myBool As Boolean = False

Dim myChar As String = ';';

While myBool = False

myChar = InputBox( ';Enter the letter B and click OK.';)

If myChar = ';B'; Then

myBool = True

End If

Loop

No comments:

Post a Comment