catch ENTER pressed event in textbox

02-13-2002, 02:12 PM
Hi, gurus

I want to get the text in textbox after a user press ENTER in the textbox. Can you help me?

02-13-2002, 02:14 PM
Try this:Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
'resetting the KeyAscii prevents the 'DING' sound
KeyAscii = 0
'do whatever: in this example, a msgbox is shown
MsgBox "Enter was pressed!", vbInformation, "Enter!"
End If
End Sub

02-13-2002, 02:18 PM

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum