双击文本框
选择KeyPress事件,出现
Private Sub Text1_KeyPress(KeyAscii As Integer)
其中KeyAscii就是对应代码
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1.text=KeyAscii
End Sub
就可以了
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1.Text = Text1.Text & KeyAscii & " "
Text1.SelStart = Len(Text1.Text)
KeyAscii = 0
End Sub