vb中用KeyPress事件判断输入字符后,怎么编辑不了Text1里的文本?
代码如下PrivateSubText1_KeyPress(KeyAsciiAsInteger)IfKeyAscii<48OrKeyAscii>57ThenKeyAscii...
代码如下
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Text1.SetFocus
End If
End Sub
输入数字后,怎么编辑不了Text1里的文本?请指导! 展开
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Text1.SetFocus
End If
End Sub
输入数字后,怎么编辑不了Text1里的文本?请指导! 展开
展开全部
在text里输入的是字符,思安把它先把它转换为integer看看
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
If KeyAscii <> 3 And KeyAscii <> 22 And KeyAscii <> 24 Then
KeyAscii = 0
End If
Text1.SetFocus
End If
End Sub
If KeyAscii < 48 Or KeyAscii > 57 Then
If KeyAscii <> 3 And KeyAscii <> 22 And KeyAscii <> 24 Then
KeyAscii = 0
End If
Text1.SetFocus
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询