December 4th, 2005, 08:45 PM
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,
December 4th, 2005, 11:25 PM
pass in the right data, throw in a simple if statement, then execute whatever code you want.
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")
December 5th, 2005, 11:01 AM
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.