Form1
Public an As String
Private Sub ProduceOrder_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
an=2
End Sub
Form2
Private Sub InOutApp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim po As New ProduceOrder
'Form1 的对象
MsgBox(po.an)
End Sub
就是这样,Form2里的不到Form1的那个值 作者:
Nothing 时间: 2005-9-13 13:32
Form1
Public an As String
Public Sub ProduceOrder_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
an=2
End Sub
Form2
Private Sub InOutApp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim po As New ProduceOrder
'Form1 的对象
po.Visible = True[/color:43abfaa218]
MsgBox(po.an)
End Sub
就是这样,Form2里的不到Form1的那个值
注意红色的,也就是说po已经创建了,但没有加载,需要加载才行。 作者:
Nothing 时间: 2005-9-13 14:27
刚写了个程序试了一下,需要加载才行。
不过还有一个办法,就是在定义的时候直接付值,例如:
Public an As String = "OK" 作者:
zslins 时间: 2005-9-13 14:49