简体   繁体   中英

Need To Open An MDI Child Form From A Non MDI Child Form

I have the scenario where I am opening a form outside of an MDI parent using the following code:

Dim frm As New frmSpeedSearch
frm.Show(Me)

I then want the ability to open an MDI child from this frmSpeedSearch. FrmMain is the MDI Parent of all child forms. From the frmSpeedSearch, I make the following call:

Dim frm As New frmStorePage(_store)
frm.Owner = frmMain
frm.Show()

But this just opens the form normally. How can I push this back into the MDI Parent container?
Within frmStorePage I make a call to the MdiParent which is failing because the form doesn't have an MDI Parent when I open it this way

Dim frm As frmDashBoard
frm = DirectCast(Me.MdiParent, frmMain)

Any suggestions would be appreciated, thanks.

You passed the MdiParent to frmSpeedSearch when you called Show().

As such, you can do:

Dim frm As New frmStorePage(_store)
frm.MdiParent = Me.Owner
frm.Show()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM