[program-l] Re: Keyboard events VB

  • From: Yannick Daniel Youalé <mailtoloco2011@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Tue, 13 Nov 2018 06:33:33 +0100

Hi Luke,

I propose you the property e.KeyChar.

As you can see in this example:

                Private Sub myTextBox_KeyPress(ByVal sender As Object, ByVal e 
As
System.Windows.Forms.KeyPressEventArgs) Handles myTextBox.KeyPress

if e.KeyChar = "a" then
MsgBox("You have pressed the letter " & e.KeyChar)
' and you can cancel the keyPress event like this
e.Handled = True
end if

End Sub

I hope that it sweet your needs.

Yannick Youalé
From Cameroon, in central Africa.



2018-11-12 21:19 UTC+01:00, Luke Scholey <l.scholey@xxxxxxxxxxxxxxxxx>:

Hi all
Are there any Visual Basic  experts on this list?
I am trying to convert a string to a value that the keypress event will
recognise and am having a lot of trouble.
Basically I’m writing a touch typing program, so I have a string, let’s say
it’s “A”, and I want the program to run a routine based on whether the
correct key was pressed or not, so in this case was the letter A typed.
I’m having issues with converting the string A, to something that keypress
will understand so it knows what key to look for.
Can anyone help?
Thanks
Luke

--
Luke Scholey
Webmaster i/c Publishing
lukescholey.co.uk
Tel: +44 7759 282586
Email: l.scholey@xxxxxxxxxxxxxxxxx

WWW.LUKESCHOLEY.CO.UK
All feedback and questions welcome. The site admin can be contacted at:
webmaster@xxxxxxxxxxxxxxxxx
All content copyright © 2012-2018 LukeScholey.co.uk
Confidentiality Notice:
This message and any attachments are private and confidential and may be
subject to legal privilege and copyright. If you are not the intended
recipient please do not publish or copy it to anyone else. If you have
received this message in error please notify the sender immediately by using
the reply facility in your email software and then remove it from your
system.
Disclaimer:
Although this email and attachments have been scanned for viruses,
LukeScholey.co.uk accepts no liability for any loss or damage arising from
the receipt or use of this communication.
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: