为什么转置是老出现下标越界
public Dim R1, R2, R3, R4, C1, C2, C3, C4 As Integer, a(), b(), c() As DoublePrivate Sub Command1_Click()
Dim a() As Integer
If IsNumeric(Text1) = False Or IsNumeric(Text2) = False Or Len(Text1) = 0 Or Len(Text2) = 0 Then
Exit Sub
End If
R1 = Val(Text1)
C1 = Val(Text2)
ReDim a(R1, C1)
For i = 1 To R1
For j = 1 To C1
a(i, j) = Val(InputBox("输入第" & Str(i) & "行第" & Str(j) & "列", "", 0))
Next j
Next i
For i = 1 To R1
For j = 1 To C1
Text7.Text = Text7.Text & Str(a(i, j)) & Space(2)
Next j
Text7.Text = Text7.Text & vbCrLf
Next i
End Sub
Private Sub Command2_Click()
R2 = Val(Text3)
C2 = Val(Text4)
ReDim a(R2, C2)
For i = 1 To R2
For j = 1 To C2
a(i, j) = Val(InputBox("输入第" & Str(i) & "行第" & Str(j) & "列", "", 0))
Next j
Next i
For i = 1 To R2
For j = 1 To C2
Text8.Text = Text8.Text & Str(a(i, j)) & Space(2)
Next j
Text8.Text = Text8.Text & vbCrLf
Next i
End Sub
Private Sub Command3_Click()
R3 = Val(Text5)
C3 = Val(Text6)
ReDim a(R3, C3)
For i = 1 To R3
For j = 1 To C3
a(i, j) = Val(InputBox("输入第" & Str(i) & "行第" & Str(j) & "列", "", 0))
Next j
Next i
For i = 1 To R3
For j = 1 To C3
Text9.Text = Text9.Text & Str(a(i, j)) & Space(2)
Next j
Text9.Text = Text9.Text & vbCrLf
Next i
End Sub
Private Sub Command4_Click()
R4 = Val(Text11)
C4 = Val(Text11)
ReDim a(R4, C4)
For i = 1 To R4
For j = 1 To C4
a(i, j) = Val(InputBox("输入第" & Str(i) & "行第" & Str(j) & "列", "", 0))
Next j
Next i
For i = 1 To R4
For j = 1 To C4
Text10.Text = Text10.Text & Str(a(i, j)) & Space(2)
Next j
Text10.Text = Text10.Text & vbCrLf
Next i
End Sub
Private Sub Command5_Click()
ReDim c(C1, R1)
For i = 1 To R1
For j = 1 To C1
c(j, i) = a(i, j)这老出现下标越界
Next j
Next i
ReDim c(1 To C1, 1 To R1)
For i = 1 To C1
For j = 1 To C2
c(i, j) = c(i, j) + a(i, R1) * b(R1, j)
Next j
Text13.Text = Text13.Text & Str(c(i, j)) & Space(2)
Next i
Text13.Text = Text13.Text & vbCrLf
End Sub