Const n = 6
Dim a(1 To n ^ 2) As Integer, b(1 To n ^ 2) As Integer
Private Sub Form_Load()
'产生n*n个两位随机正整数,保存数组a,显示在List1中,代码略。
End Sub
Private Sub Command1_Click()
Dim i As Integer, j As Integer, xy(1 To 4) As Integer
Dim s As String, tmp As String, c As String
s = Text1.Text + "," + Text2.Text + ","
tmp = "": j = 0
For i = 1 To Len(s)
c = Mid(s, i, 1)
If c >= "0" And c <= "9" Then
tmp = tmp + c
Else
j = j + 1
tmp = ""
End If
Next i
For i = 1 To n
For j = 1 To n
If i>= xy(1) And i<= xy(3) And j >= xy(2) And j <= xy(4) Then
b((i - 1) * n + j) =
Else
b((i - 1) * n + j) = a((i - 1) * n + j)
End If
Next j
Next i
List2.Clear: c = ""
For i = 1 To n * n
c = c + Str(b(i))
If Then
List2.AddItem c
c = ""
End If
Next i
End Sub