Private Sub Command1_Click ()
Dim a(1 To 200) As String ‘用来存储学号
Dim b(1 To 200) As String ‘关联a数组,用于矩阵输出
Dim i As Integer,j As Integer,k As Integer,pos As Integer
Dim row as Integer,column as Integer,s As String
For i=1 To 200 ‘产生3位数的学号
a(i)=Mid(“00”,1,(3-Len(CStr(i)))+CStr(i) ‘CStr()函数功能转换为字符串并去掉前面空格
Next i
row=Val (Text1.Text)
column= Val (Text2.Text)
k=1
For i=1 To column
If Then
pos=i ‘pos是b数组的下标,根据行列来关联a数组
For j=1 To row
b(pos)=a(k)
k=k+1
Next j
Else
pos=(row-1)*column+i
For j=1 To row
b(pos) = a(k)
pos=pos-column
k=k+1
Next j
End If
Next i
For i=1 To row ‘按行输出学生信息
s=“”
For j=1 To column
s=s+""+
Next j
List1 AddItem s
Next i
End Sub