3个回答
展开全部
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim n As Integer, a As String
If Not IsNumeric(Chr(KeyAscii)) And Chr(KeyAscii) <> "." And Chr(KeyAscii) <> "-" and keyascii<>8 Then
KeyAscii = 0
End If
End Sub
Dim n As Integer, a As String
If Not IsNumeric(Chr(KeyAscii)) And Chr(KeyAscii) <> "." And Chr(KeyAscii) <> "-" and keyascii<>8 Then
KeyAscii = 0
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个好做:
只要在textbox的键盘敲击事件里写这样的代码:
if keyascii < 48 and keyascii >57 and keyascii <> 46 and keyascii <> Chr(KeyAscii) <> "-" Then
keyascii = 0
end if
就OK了!
还有不懂的加我QQ:357731659
只要在textbox的键盘敲击事件里写这样的代码:
if keyascii < 48 and keyascii >57 and keyascii <> 46 and keyascii <> Chr(KeyAscii) <> "-" Then
keyascii = 0
end if
就OK了!
还有不懂的加我QQ:357731659
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询