vb中如何用一个textbox只允许英文字母和数字输入
答案:1 悬赏:50 手机版
解决时间 2021-03-01 02:02
- 提问者网友:做自己de王妃
- 2021-02-28 06:17
vb中如何用一个textbox只允许英文字母和数字输入
最佳答案
- 五星知识达人网友:一叶十三刺
- 2021-02-28 06:22
Option Explicit
Private Sub Text1_Change()
Dim i As Integer, a As Integer
Dim c As String
Dim s As String
For i = 1 To Len(Text1)
c = Mid(Text1, i, 1)
a = Asc(c)
If a >= 97 And a <= 122 Then
s = s & c
ElseIf a >= 48 And a <= 57 Then
s = s & c
ElseIf a >= 65 And a <= 90 Then
s = s & c
End If
Next i
Text1 = s
End Sub
Private Sub Text1_Change()
Dim i As Integer, a As Integer
Dim c As String
Dim s As String
For i = 1 To Len(Text1)
c = Mid(Text1, i, 1)
a = Asc(c)
If a >= 97 And a <= 122 Then
s = s & c
ElseIf a >= 48 And a <= 57 Then
s = s & c
ElseIf a >= 65 And a <= 90 Then
s = s & c
End If
Next i
Text1 = s
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯