求助:标准模块中的sub过程怎么不能调用窗体中的数据?
我在一个标准模块中定义了一个求矩阵转置的SUB过程
Option Base 1
Public ROW, Col As Integer '定义矩阵的行和列
Public i, j As Integer
Public Sub MatrixTR(MA() As Double, MAT() As Double, ROW, Col)
ReDim MA(ROW, Col) As Double
ReDim MAT(Col, ROW) As Double
For i = 1 To ROW
For j = 1 To Col
MAT(j, i) = MA(i, j)
Next j
Next i
End Sub
在窗体中调用该过程
Private Sub Command1_Click()
Dim B() As Double
Dim BT() As Double
ReDim B(3, 2) As Double
B(1, 1) = 1.5: B(1, 2) = 4.7
B(2, 1) = 6.2: B(2, 2) = 3.5
B(3, 1) = 4.7: B(3, 2) = 8.2
Call MatrixTR(B, BT, 3, 2)
For i = 1 To 2
For j = 1 To 3
Print BT(i, j),
Next j
Print
Next i
end sub
为什么打印出来的2×3矩阵BT的元素全部为0啊?
请指教!谢谢!