Software Development Network>> Microsoft ISV>> Does KeyPress event trap "Backspace" key?
Code is following:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case 8 MsgBox KeyAscii Case 27 MsgBox KeyAscii Case Asc("1") To Asc("9") MsgBox KeyAscii Case Else KeyAscii = 0 End SelectEnd Sub
Then I press BACSPACE or ESC nothing happen. why
per our support engineer:
All of the documents have some problem. KeyPress can’t capture the backspace event.
Only KeyDown can do it.
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
MsgBox KeyCode
End Sub
Regards, Xiang
-brenda (ISV Buddy Team)
can you share a sample of your code for us to test out
thanks,-brenda (ISV Buddy Team)
Does KeyPress event trap "Backspace" key?
lchase4411
Code is following:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 8
MsgBox KeyAscii
Case 27
MsgBox KeyAscii
Case Asc("1") To Asc("9")
MsgBox KeyAscii
Case Else
KeyAscii = 0
End Select
End Sub
Then I press BACSPACE or ESC nothing happen. why
Craig Guyer - MSFT
per our support engineer:
All of the documents have some problem. KeyPress can’t capture the backspace event.
Only KeyDown can do it.
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
MsgBox KeyCode
End Sub
Regards, Xiang
-brenda (ISV Buddy Team)
Joseph Kasende
can you share a sample of your code for us to test out
thanks,
-brenda (ISV Buddy Team)