Get enter button command
-
VB.NET 2005: I want a user to type their nam, then make it so my program recognises when the user presses the enter key (or they can click on the button), then acts as tho a button has been pressed, how would i do this, is it a press down event?
-
VB.NET 2005: I want a user to type their nam, then make it so my program recognises when the user presses the enter key (or they can click on the button), then acts as tho a button has been pressed, how would i do this, is it a press down event?
Well it is not complicated. You define the procedure as a sub or function what has to be handled when user pushes the enter key. Check this code please. :wtf:
' Handle the KeyDown event to determine the type of character entered into the control. Private Sub textBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) _ Handles textBox1.KeyDown ' Determine whether the keystroke is a number from the top of the keyboard. If e.KeyCode = 13 Then Call DoMyTask() ' That must be your procedure or function End If End Sub
What a curious mind needs to discover knowledge is noting else than a pin-hole.
-
Well it is not complicated. You define the procedure as a sub or function what has to be handled when user pushes the enter key. Check this code please. :wtf:
' Handle the KeyDown event to determine the type of character entered into the control. Private Sub textBox1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) _ Handles textBox1.KeyDown ' Determine whether the keystroke is a number from the top of the keyboard. If e.KeyCode = 13 Then Call DoMyTask() ' That must be your procedure or function End If End Sub
What a curious mind needs to discover knowledge is noting else than a pin-hole.
How do i referance to something like a btn1_Click command?
-
How do i referance to something like a btn1_Click command?
-
Make sure you have a button click event attach to your button then use code some what like this to actuate it.
YourButton_Click(YourButton, New EventArgs)
Sorted, cheers for your help :)