Private Sub Search_Click()
Const n = 12
Dim s As String, c As String
Dim i As Integer, t As Integer
Dim rs(0 To n) As Integer '数组rs存储班级人数
Dim bj(1 To n) As Integer '数组bj存储班级编号
Dim flag As Boolean
s = Text1.Text
t = 0
For i = 1 To Len(s)
c = Mid(s, i, 1)
If c >= "0" And c <= "9" Then
t = ①
flag = True
ElseIf flag = True Then
rs(t) = rs(t) + 1
flag = False
t = 0
End If
Next i
For i = 1 To n
bj(i) = i
Next i
For i = 1 To n-1
k = i
For j = i + 1 To n
If ② Then k = j
Next j
If k <> i Then
t = rs(k): rs(k) = rs(i): rs(i) = t
t = bj(k): bj(k) = bj(i): bj(i) = t
End If
Next i
For i = 1 To n
List1.AddItem Str(bj(i)) + "班有:" + " " + + "人"
Next i
End Sub