-
Is there a way to call a command button when enter is pushed in a textbox without having it beep and still retaining the password char? I tried making it multiline and putting its selstart back to 1 before calling the command button and that worked but it no longer uses the password char when its multiline.
-
you could set that command button's Default to True. That way, whenever enter is pressed, the command button is activated.
bob
-
unfortunately it still beeps?? but is presses command one, when enter is pressed
Code:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print KeyCode
If KeyCode = 13 Then
KeyCode = 35
Command1.Value = True
End If
End Sub
-
It is quite easy. Simply test for the enter key (13) and set keyascii = 0, then call the command1_click event
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Command1_Click
'or Command1.Value = True
End If
End Sub
-
i had the same as iain
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 0
Command1.Value = True
End If
End Sub
but where i stuffed up, was inside the command1_click code,
i had a msgbox event, which makes a beep sound,
so iain's version does not make a beep, unless it is raised in the command button's code.
but why does this not work with keycode, is it because the textbox has already intercepted the call for that character?