[求助]如何引用另一过程中的变量和数组?
引程序代码如下:
Public Sub Command1_Click()
CommonDialog1.ShowOpen
Dim files As String, i As Integer, a()
files = CommonDialog1.FileName
Dim inbuf As String
Dim num As Integer 'num为文件行数,也即荷载间距数目
Open files For Input As #1 '打开文件
num = 0
Do While Not EOF(1) '获取文件行数
Line Input #1, inbuf
num = num + 1
Loop
Close #1
ReDim a(1 To num) '荷载间距(一维数组)
Open files For Input As #1
For i = 1 To num '将每行数据赋值给数组a
Input #1, a(i)
Next i
Close #1
End Sub
Public Sub Command2_Click()
Text1.Text = num
Text2.Text = a(1)
End Sub
我想在command2_click()中直接引用command1_click()中的变量num和数组a,可是在运行时出错:子程序或函数未定义。请问应该如何解决?谢谢!