|
-
Jul 26th, 2004, 01:08 PM
#1
Thread Starter
Frenzied Member
'attaching' a button to a textbox
Why does this not worK? I'm trying to trap the 'enter' key when pressed but debugging shows me that chr(13) isn't detected.
VB Code:
Private Sub tab_2_txtSearchByPhone_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles tab_2_txtSearchByPhone.KeyPress
'Purpose : Detects when the Enter button is pressed.
If e.KeyChar = Chr(13) Then
e.Handled = True
GetHistory(RemoveChar(tab_2_txtSearchByPhone.Text, "-"c), True)
End If
End Sub
Last edited by Andy; Jul 26th, 2004 at 01:49 PM.
-
Jul 26th, 2004, 04:40 PM
#2
Frenzied Member
Seems like that should work - I copied and pasted your code, then added a message box, and the message box pops up.
VB Code:
If e.KeyChar = Chr(13) Then
e.Handled = True
'GetHistory(RemoveChar(tab_2_txtSearchByPhone.Text, "-"c), True)
MessageBox.Show("You pressed enter.")
End If
-
Jul 26th, 2004, 09:08 PM
#3
Hyperactive Member
you chould try
VB Code:
If e.KeyValue = 13 Then
e.Handled = True
MessageBox.Show("You pressed enter.")
End If
-
Jul 26th, 2004, 09:08 PM
#4
Thread Starter
Frenzied Member
now i'm confused. It works for me too in a dummy app. i am using a custom textbox. I'll have to open up the source code to see if chr(13) is blocked.
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
|