How would I assign something to when I hit enter in a text box ?
Here is what I have
text1
and
txtConsole
When I hit enter in text 1 I want the text from text to go into txtConsole.. can anyone help ?
Printable View
How would I assign something to when I hit enter in a text box ?
Here is what I have
text1
and
txtConsole
When I hit enter in text 1 I want the text from text to go into txtConsole.. can anyone help ?
Set the form's KeyPreview property to False, then place some simple code likein the KeyPress event of the form which responds when you press enter. You'll need to look up the key code, I can't rmember it.Code:If Keyascii = ?? Then
txtConsole.Text = Text1.Text
End if
vbKeyReturn
..or
Code:Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtConsole = Text1
End Sub
True, just a little less readable..;)