模块Module1  (写入下面代码)
Public m(1)  As Long, i As Long
form1 (设定了一个按钮两个文本框 写入下面的代码)
Private Sub Form_Load()
m(0) = Val(Text1.Text)
m(1) = Val(Text2.Text)
  End Sub
Private Sub Command1_Click()
    Form2.Show
End Sub
form2 (写入下面的代码)
Private Sub Form_Load()
 For i = 0 To 1
    Print m(i)
   Next i
 End Sub
运行后  什么也不显示

解决方案 »

  1.   

    不是传不了数组,而是你这代码写得...
    Form_Load时窗体还没有建立print是无效的
    同样此时m(x) = Val(Text1.Text)也是无效的,应写到 Command1_Click里
      

  2.   

    Form1代码:Option ExplicitPrivate Sub Command1_Click()
        m(0) = Val(Text1.Text)
        m(1) = Val(Text2.Text)
        Form2.Show
    End SubPrivate Sub Form_Load()
        Text1.Text = "1"
        Text2.Text = "2"
    End Sub
    Form2代码:Option ExplicitPrivate Sub Form_Load()
        Me.Caption = "m(0)=" & m(0) & ";m(1)=" & m(1)
    End Sub
    标准模块代码:Option ExplicitPublic m(1) As Long
    Public i As Integer
      

  3.   

    to veron_04:
       谢谢 我还想再问下有两个窗体: form1 form2 假设form1 为主窗体,窗体内有一按钮 单击按钮,出现form2 form2中有text控件,可以输入数据 在form2中输入数据后,单击form2中的 确定 按钮后,输入的数据存入一个数组中,同时 form2关闭,form1窗体出现 然后在FORM1窗体中调用 form2 中输入的数据(以数组形式),进行运算 如何实现 ?