PDA

View Full Version : Keypress event handling


ceal21c
05-24-06, 15:44
Hey Guys,

Could someone help me out with some sample code that would allow me to detect when the enter key is pressed in a textbox. I've read that I need to configure event handling for the textbox etc. but I'm not sure exactly what that means.

Kodo
05-24-06, 17:56
we first need to know what language you are using.

ceal21c
05-25-06, 09:46
I'm using VB6. This code did the job for me:

Private Sub txtGetAnswer_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0 ' Prevent Carriage Return reaching textbox
'Do something here
End If
End Sub