-
How do I make a command button keep focus while the user is typing in a text box? Dialog boxes have this feature so that when the user finishes typing, he/she can just hit enter. My form has several text boxes and several command buttons. I want each text box to have a cooresponding command button. Thanks in advance.
-
Hi :) I think that this will work
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = Chr(13) Then
{Put the code that is in the Command1_click in here}
end if
End Sub
Hope that it Works :cool: :cool: :cool:
-
instead of copying over the code from command1_click ... you can just call the command1_click procedure
and chr(13) should just be 13 I believe
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
command1_click
end if
end sub
------------------
Rapmaster
-
Thanks guys. The code works great. I don't know why I didn't think if it before... ;-)
There is one thing though. My text boxes are not multilined, of course, and whenever the I hit enter, the Windows default sound plays. Is there anyway to prevent that? Multilined text boxes would execute the return and then my code. Thanks again.