|
-
Jan 21st, 2003, 04:35 PM
#1
Thread Starter
Hyperactive Member
How do I check for the Enter key in a textbox?
-
Jan 21st, 2003, 04:57 PM
#2
Sleep mode
you mean if it's pressed in the textbox ??
-
Jan 21st, 2003, 05:01 PM
#3
Thread Starter
Hyperactive Member
yeah, it's basically a follow on from the all of the sudden... thread, you type something into a textbox, press return and I want to capture that so I can do something.
-
Jan 21st, 2003, 05:02 PM
#4
Sleep mode
you seem so busy
if that what you mean then check this :
VB Code:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As _
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Asc(e.KeyChar()) = 13 Then
MsgBox("You Pressed Enter Key")
' put your code here
End If
End Sub
-
Jan 21st, 2003, 05:05 PM
#5
Sleep mode
two posts at the same time
-
Jan 21st, 2003, 05:09 PM
#6
Thread Starter
Hyperactive Member
I get a blue squiggle under e.KeyChar and it tells me that 'KeyChar' is not a member of 'System.EventArgs'. Does something need declaring?
-
Jan 21st, 2003, 05:11 PM
#7
Sleep mode
that code should go under the KeyPress EVENT .
-
Jan 21st, 2003, 05:17 PM
#8
Thread Starter
Hyperactive Member
Yeah, your right. When I double-clicked on the textbox to get the code, it gave me this:
VB Code:
Private Sub txtUserInput_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtUserInput.TextChanged
End Sub
and I assumed that would be ok. But what do I know, pah
-
Jan 21st, 2003, 05:23 PM
#9
Sleep mode
in the code editor click the first code on the top left "Class Name" scroll down and select your textbox then on the right combobox scroll down to KeyPress event , click it , write your code there .Done !
-
Jan 21st, 2003, 05:29 PM
#10
Thread Starter
Hyperactive Member
-
Jan 21st, 2003, 05:31 PM
#11
Sleep mode
-
Jan 21st, 2003, 05:38 PM
#12
Thread Starter
Hyperactive Member
...and I call myself a VB programmer!
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
|