VB6.0 一个输入框中输入一个字母键,自动把这个键转换成数字形式的键码

2024-11-29 15:00:49
推荐回答(2个)
回答1:

双击文本框
选择KeyPress事件,出现
Private Sub Text1_KeyPress(KeyAscii As Integer)
其中KeyAscii就是对应代码

Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1.text=KeyAscii
End Sub
就可以了

回答2:

Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1.Text = Text1.Text & KeyAscii & " "
Text1.SelStart = Len(Text1.Text)
KeyAscii = 0
End Sub