[求助]VB6共享事件问题
偶一个程序中,用了9个文本框控件Text1到Text9,这9个文本框都有输入验证,只能输入数字、退格、空格和回车。是这样做的:
'输入字符验证,只能输入数字、小数点和退格键,且输入空格或回车时跳到下一文本框
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 8 Then
KeyAscii = 8
Exit Sub
End If
If KeyAscii = 13 Or KeyAscii = 32 Then
KeyAscii = 0
SendKeys "{tab}"
Exit Sub
End If
If KeyAscii <> 46 And KeyAscii < 48 Or KeyAscii > 58 Then
KeyAscii = 0
Text15.Text = "只能输入数值!"
Exit Sub
End If
Text15.Text = ""
End Sub
。
[此贴子已经被作者于2006-10-26 14:18:26编辑过]