7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Text1_Change()
S = Right(Text1.Text, 1)
If Not IsNumeric(S) And Len(S) <> 0 Then
MsgBox "必须输入数字!", vbOKOnly, "输入数据类型错误"
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
Text1.SelStart = Len(Text1.Text)
End If
End Sub
static check(48 to 57) as boolean
if keyascii=13 then
text1=""
erase check
exit sub
end If
if keyascii<48 or keyascii>57 then
keyascii=0
msgbox "必须输入数字"
exit sub
else
if check(keyascii) then
keyascii=0
msgbox "数字重复了"
exit sub
end if
end if
check(keyascii)=true
Private Sub Text1_Change()
S = Right(Text1.Text, 1)
If Not IsNumeric(S) And Len(S) <> 0 Then
MsgBox "必须输入数字!", vbOKOnly, "输入数据类型错误"
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
Text1.SelStart = Len(Text1.Text)
End If
S1 = Left(Text1.Text, Len(Text1.Text) - 1)
If InStr(S1, S) <> 0 Then
MsgBox "不能有重复的!", vbOKOnly, "输入数据类型错误"
Text1.Text = S1
Text1.SelStart = Len(Text1.Text)
End If
End Sub