I know this is a simple thing to do but I cant for the lie of me remember how to catch an "Enter" in a text field.
if anyone has the time, pls post an example for this so i can finish my program :)
help for any thanks >;)
Printable View
I know this is a simple thing to do but I cant for the lie of me remember how to catch an "Enter" in a text field.
if anyone has the time, pls post an example for this so i can finish my program :)
help for any thanks >;)
Check out the KeyPress and KeyDown events of the textbox, and then use the code for an Enter key (which i think is vbKeyEnter, not sure though). If you open up the Objects browser in VB, there is a list of constants like this.
or failing that, you could always use a command button with its Default property set to true (you could hide it under the text box if you wanted.
It's vbKeyReturn
Here's the code (I think)
Code:Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
'Do your code here
End If
End Sub