|
-
Oct 4th, 2012, 03:42 PM
#1
Thread Starter
Addicted Member
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
Last edited by Reapism; Oct 4th, 2012 at 03:46 PM.
Reason: I messed up the title :(
-
Oct 4th, 2012, 03:58 PM
#2
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 .... ?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Oct 4th, 2012, 04:01 PM
#3
Thread Starter
Addicted Member
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.
-
Oct 4th, 2012, 04:27 PM
#4
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
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Oct 4th, 2012, 04:35 PM
#5
Thread Starter
Addicted Member
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 :_
-
Oct 5th, 2012, 02:59 AM
#6
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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|