作业请教帮忙做一下谢谢
题目:编写程序,在文本框(Text1)中输入一段文本,单击统计按钮,分别统计英文字母、数字字符的个数,显示在文本框(Text2和(Text3)中。运行结果如图[local]1[/local]。
Private Sub Command1_Click()
Dim E1 As Long, N1 As Long
Dim C1 As Long
Dim i As Long, o As Long
Dim s As String
s = Text1.Text
For i = 1 To Len(s)
o = Asc(Mid(s, i, 1))
If o >= 48 And o <= 57 Then '数字
N1 = N1 + 1
ElseIf o >= 97 And o <= 122 Then '小写字母
E1 = E1 + 1
ElseIf o >= 65 And o <= 90 Then '大写字母
E1 = E1 + 1
End If
Next i
Text2.Text = "字母个数:" & E1
Text3.Text = "数字个数:" & N1
End Sub