The user fill a textfield in the preferences window of my application with
what letters (+ ALT) associated they want to use for certain functions.
Since that's a String I get from the USer I nee to get that into something
that I can compare with in the Event for the KeyDown.
If you know of a really good way of doing this without using my way I'm
happy to hear cause my solution feels a bit "ugly"
If Chr(e.KeyValue) = UserVariableAsString AndAlso (e.Alt) Then
Me.dgrResources.Focus()
ElseIf Chr(e.KeyValue) = UserVariableAsString2 AndAlso e.Modifiers =
Keys.Alt Then
Me.dgrCodes.Focus()
End If
/Lars Netzel
"Armin Zingler" <az*******@freenet.de> skrev i meddelandet
news:40***********************@news.freenet.de...
"Lars Netzel" <[stop_spam]@host.topdomain> schrieb "Lars Netzel" <[stop_spam]@host.topdomain> schrieb
> If I press the Key "a" on the keyboard, all the events and
> properites will only give me "65" as keycode.. and I want it to
> give me "a".
>
> If I use the KeyPress event.. then I will have access to
> e.KeyChar which will give me the "a" but I can't use that here..
> I need to use the KeyDown.. since you can only capture ONE key in
> KeyPress and I'm looking for Several Keys.
>
> So I need to convert the KeyCode "65" into a Character... any
> ideas on how?
If you want to process chars, use KeyPress.
If you want to process keys, use KeyDown.
Why can't you use
if e.keycode = System.Windows.Forms.Keys.A then
?
Cause I have dynamic Hotkeys... the user can choose what To compare
with so I can's use the static comparision you suggested.
I don't understand. You can also use a variable of type
System.Windows.Forms.Keys instead of directly using the constant to
compare to.
--
Armin
How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html