-
December 4th, 2005, 08:45 PM
#1
Junior Member
VB .net question
I am writing my first VB .net program and want to know, how I can recognise when someone presses the return key when a specific text box has focus. As I want to execute some code when someone has entered some text in this text box and hit the return key.
Thanx in advance,
TTAYO
-
December 4th, 2005, 11:25 PM
#2
Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Return Then
MsgBox("detects that the return/enter has been pressed")
End If
End Sub
pass in the right data, throw in a simple if statement, then execute whatever code you want.
-
December 5th, 2005, 11:01 AM
#3
Junior Member
Thanx for that!
I know that it was a simple piece of code, as I could do it with VB6. But I haven't programmed in VB for about 3 years and I need to catch up and refresh my memory.
L8R,
TTAYO
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
|
|