Posted: Thu Aug 23, 2007 4:03 pm Post subject: here is your answer noob attack
ok i figured out how to do it.
make sure you put this code into your form and change the method to keydown. also make sure to change the keypreview to true on the properties window.
Code:
if e.keycode = keys.a and e.modifiers = keys.control then
messagebox.show("hello world")
e.handled = true
end if
thats just an example with a messagebox now you figure out how to do it with a button
edit: here is how to do it with a button i guess i will give you the answer this time
create a button, lets use crtl+A again
so on form1 make sure keypreview = true
Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.H And e.Modifiers = Keys.Control Then
Button1.Select()
e.Handled = True
End If
End Sub
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Hello World")
KeyPreview = True
End Sub
this is if the user wants to click the button it shows the message hello world
Code:
Private Sub Button1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Button1.KeyPress
MessageBox.Show("Hello World")
KeyPreview = True
End Sub
this is so if the user wants to press crtl+a to show the message hello world
now you have 2 examples of how to do this but the answer you were looking for was the button answer so please enjoy and i wouldnt mind that rep like you promessed _________________
"The flame that burns twice as bright burns half as long"
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum