文本框防止非法字符输入 只输入整数 Private Sub Text_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case Asc(\\) To Asc(\\) vbKeyBack \nop Case Else KeyAscii = End Select End Sub 只输入小数: Private Sub Text_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case Asc(\\) To Asc(\\) vbKeyBack \nop case Asc(\\)\允许一个小数点 If InStr( TextText \\) > Then KeyAscii = Case Else KeyAscii = End Select End Sub |