converting e.KeyCode to the keyboard value in a message
Posted on 2009-03-29
How do I convert e.KeyCode to the actual keyboard key name like "F1" where the line of code would look like:
MsgBox(ConvertThis(e.KeyCode) & " is an invalid key. Please choose F2 through F9 only.", CType((MsgBoxStyle.Information + MsgBoxStyle.OkOnly), MsgBoxStyle), "Lenny's Message")
Where ConvertThis is a function that will convert e.KeyCode to the function key or keyboard character that the user depressed.
The messagebox would have this message, if the F1 key was depressed by the user:
F1 is an invalid key. Please choose F2 through F9 only.