一道VB题!!急!!!

来源:百度知道 编辑:UC知道 时间:2024/05/22 10:48:44
在窗体上有一个名称为C1,标题为"统计"的命令按扭.四个名称为label1,2,3,4的标签,标签标题分别为"输入""数字""字母"和"其他"四个文本框.名称分别为text1,2,3,4.text属性均为空.
要求程序运行后,首先在text1中输入若干字符.然后单击"统计"按扭.则分别求出text1中数字字母及其他字符的个数.并显示在相应的文本框中.把代码中问号部分改正过来.把注释符删了.代码如下
Private Sub Command1_Click()
Dim s1 As String, s2 As String
Dim c1 As Integer, c2 As Integer, c3 As Integer
Dim j As Integer, l As Integer
c1 = 0: c2 = 0: c3 = 0
s1 = Trim(Text1)
'l=?(s1)
For j = 1 To l
s2 = Mid(s1, j, 1)
'if s2>="0"? s2<="9" then
c1 = c1 + 1
'elseif s2>="a" and s2<="z"? then
c2 = c2 + 1
Else
'?
End If
Next j
Text2 = c1: Text3 = c2 + Text4 = c3
End Sub

谢谢啊!!!!

Private Sub Command1_Click()
Dim s1 As String, s2 As String
Dim c1 As Integer, c2 As Integer, c3 As Integer
Dim j As Integer, l As Integer
c1 = 0: c2 = 0: c3 = 0
s1 = Trim(Text1)
l = Len(s1)
For j = 1 To l
s2 = Mid(s1, j, 1)
If s2 >= "0" And s2 <= "9" Then
c1 = c1 + 1
ElseIf s2 >= "a" And s2 <= "z" Or s2 >= "A" And s2 <= "Z" Then '大小写字母都统计到了~~~
c2 = c2 + 1
Else
c3 = c3 + 1
End If
Next j
Text2 = c1: Text3 = c2: Text4 = c3
End Sub

Private Sub Command1_Click()
Dim s1 As String, s2 As String
Dim c1 As Integer, c2 As Integer, c3 As Integer
Dim j As Integer, l As Integer
c1 = 0: c2 = 0: c3 = 0
s1 = Trim(Text1)
l=len(s1)
For j = 1 To l
s2 = Mid(s1, j, 1)
if s2>="0" and s2<="9" then
c1 = c1 + 1
elseif s2>="a" and