How do I get the 'Enter' Key to work?

MrSimtang
04-20-2003, 03:17 AM
For my program, I want my enter button to work once I type in text.

What's the code?

vbfan
04-20-2003, 03:23 AM
I hope that I had understand you right.

Private Sub Text1_KeyPress(keyAscii AS integer)
IF KeyAscii = 13 then
Command1_Click
End IF
End Sub

MrSimtang
04-20-2003, 04:11 AM
Ok thank you vbfan!!!

Squirm
04-20-2003, 04:21 AM
If all you want to do is cause the Enter key to click a commandbutton, you can simply set the Default property of the commandbutton to True.

:)

vbfan
04-20-2003, 04:22 AM
I had forgot to say, that you need to set the Keypreview to true of the Form

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum