Hidden Commands using Keycodes(Hotkeys)
I have been fiddling with the keys and stuff and I stumbled upon adding a "Secret" key that opens up a form.
I have been trying to add this key to Form1.load() so it is secret but upon doing so I receive a error
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Reap As System.EventArgs
Reap.keycode = Keys.F1 then
Form1.Show()
'I understand you can use e.keycode but I like to be fancy :P
How do I make it work, Should i have a default focus and then add the keycode method or using the form1.load() Please be explanatory
All replies are invaluable.
I am new to the VBForums, be nice :) I am only 16
Re: Hidden Commands using Keycodes(Hotkeys)
Er ... um ... well ... nope, haven't a clue what you're trying to do. Are we talking about an application that's running with a hidden form or do you want to start a new application on a hotkey or .... ?
Re: Hidden Commands using Keycodes(Hotkeys)
I am essentially trying to have form1 have a hidden feature of when pressing F1 it will open up a form. I am not entirely sure on how these all work but I am trying to explain the best I can on my current struggle.
Re: Hidden Commands using Keycodes(Hotkeys)
Well, much as you like to be fancy, there's no substitute for just plain old logic. You meed to detect a key press then you use a key event ...
vb.net Code:
Private Sub Form1_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown, TextBox1.KeyDown 'etc.
' the important thing to do here is to add all controls which have a keydown event in the handles section
' otherwise it will only be detected when no control has focus
If e.KeyCode = Keys.F12 Then Form2.Show() ' I wouldn't use F1, it has far too many associations already!
End Sub
Re: Hidden Commands using Keycodes(Hotkeys)
Thanks so much I actually did this before I read this and I acknowledge your feedback, but yes I am running into a problem where button1 has focus on form1 load so I added under Form1.load Me.Focus() But that did not work so I just made the key event on the button as well :_
Re: Hidden Commands using Keycodes(Hotkeys)
Code:
Dim Reap As System.EventArgs
Reap.keycode = Keys.F1 then
Are you actually using late binding there ? Stop that blasphemous practice ASAP :o