假设你要显示的窗体是Form2,首先在Form2中加入下面的代码:Public Sub showme() Me.Show End Sub然后在工程中引用Microsoft Script Control ,然后在主窗体中添加commandbutton,在其中加入以下代码:Private Sub Command1_Click() Dim x As New ScriptControl Dim c As New Class1 Dim frm As New Form2
x.Language = "VBScript" x.AllowUI = True x.AddObject "frm", frm x.Eval "frm.showme" End Sub
Me.Show
End Sub然后在工程中引用Microsoft Script Control ,然后在主窗体中添加commandbutton,在其中加入以下代码:Private Sub Command1_Click()
Dim x As New ScriptControl
Dim c As New Class1
Dim frm As New Form2
x.Language = "VBScript"
x.AllowUI = True
x.AddObject "frm", frm
x.Eval "frm.showme"
End Sub