|
-
May 1st, 2000, 04:29 AM
#1
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.
-
May 1st, 2000, 09:13 AM
#2
Hyperactive Member
you could set that command button's Default to True. That way, whenever enter is pressed, the command button is activated.
bob
-
May 1st, 2000, 06:34 PM
#3
Conquistador
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
-
May 1st, 2000, 06:39 PM
#4
Fanatic Member
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
Iain, thats with an i by the way!
-
May 1st, 2000, 06:45 PM
#5
Conquistador
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?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|