Public 实例化 As Boolean
Private Sub Form_Load()
实例化 = True
End SubPrivate Sub Form_Unload(Cancel As Integer)
实例化 = False
End SubIf Form1.实例化 Then MsgBox "已经实例化" Else MsgBox "还没实例化"
Private Sub Form_Load()
实例化 = True
End SubPrivate Sub Form_Unload(Cancel As Integer)
实例化 = False
End SubIf Form1.实例化 Then MsgBox "已经实例化" Else MsgBox "还没实例化"
msgbox "No Form2"
else
msgbox "Form2 Loaded"
end if
For Each a In Forms
If a.Name = Form1.Name Then MsgBox "已经加载"
Next
我用你的方法不行,if form2=nothing then 在运行时报错,用if form2 is nothing then 又不起作用。
for each frmTemp in forms
msgbox frmTemp.name
next