vb中如何将form1的数据传入form2?

来源:百度知道 编辑:UC知道 时间:2024/05/31 09:36:23
我想在form2中调用form1中计算出来的数据。我不是很懂vb,毕业设计用的!!!

'''''''Form1中没有相应控件保存数据的时候:
'================================
'Form1置顶写入以下(窗体Form1):
'----------------------------------------
Option Explicit
Public value_to_Form2 As String
'----------------------------------------

'将form1中计算出来的数据保存到 value_to_Form2 中。

'调用,例如要在Form2的Text1中显示数据(窗体Form2):
'----------------------------------------
Text1 = Form1.value_to_Form2
'----------------------------------------

'''''''Form1中有相应控件保存数据的时候:
'调用,例如数据在Form1的Label1控件中,Form2的Text1中显示数据(窗体Form2):
'----------------------------------------
Text1 = Form1.Label1
'----------------------------------------

计算出来的数据如果显示在text1.text中..

Form2.label1.Caption = text1.text

或者申明一个变量date = text1.text

Form2.label1.Caption = date

================================================