-
MDI form confusion
Hi guys,
I have a little problem when creating MDI style in VB.NET. In the MDIcontainer form (Form1) , I put a button and in its click event I wrote these codes:
dim frmchild as New form2
frmchild.MDIParent = Me
frmchild.Show()
OK, then the MDIChild showed up...No problemo...it run well. But when I click the button again, another MDIChild form showed in the MDIContainer form...again and again. Is there a way to stop the MDIChild from keep on showing ?
THX
-
Private frm as form
In the button click event ....
if frm is nothing then
frm = new myform
frm.MDIParent = me
frm.show()
endif
-
Hi Bryan,
there's a new problem...
when I close the MDIChild form and
try to show it again by clicking the button
in the MDIContainer, the MDIChild form
never shows up...weird isn't it?
-
When you close the form you should set the reference to nothing so that it can re-enter the if statement. ie
frm.close()
frm = nothing