I got a weird problem with MDI Parent form.
I open forms like -> Login Form(is not a MdiContainer) -> MdiParent (Is a MdiContainer).
But I wanted to pass a boolean value from Login Form to MdiParent Form so I declared a Friend variable in MdiParent Form and called MdiParent Object in Login Form as shown in below code.
Dim frm As New MdiParent
'frm.NormalMode = True
frm.Show()
Everything works fine. MDIParent form opened as expected.
But I have some child form in MdiParent form.
A child Form has a button which does is open another child form with Parent MDIParent shown below.
Dim frm1 As New Child2
frm1.MdiParent = MdiParent
frm1.anyvariable = value
frm1.Show()
But now it won't open. Like on button click it comes to the breakpoint passes through frm1.show()
command line but it won't open.
Before I was Opening MDIParent directly like MdiParent.show()
and everything worked fine.
All child Forms opened properly with this code.
Something Extra:
Also, When I run with MdiParent.Show()
and Pause the code in VS2017 and uncomment the MDIParent code with Object (the one above) and comment MdiParent.Show()
It works fine. Again, stopping and replaying the code creates issues.
Also, I didn't use that Boolean variable in MdiParent Form yet so it's not a problem I guess.
Using a Public variable is a convenient way, for now, I guess.
Also declaring Friend variables between two child forms is not an issue at all.