EricDotNet Posted March 24, 2004 Posted March 24, 2004 Dear all Since I have a MDI Container Form (frmMain), It contain a menu item (Open frmA) frmA is a MDI Child form, It have a button (Open frmB which is also a MDI Child form under frmMain) The problems is that When I open frmB from frmA button, frmB does not under frmMain How can I open frmB as a MDI Form under frmMain? Quote
Celeron Posted March 24, 2004 Posted March 24, 2004 Create a global variable in a Module, at the beginning of your program, have that variable be a reference to frmMain frm = frmMain Then from the child forums, just use frm(the global reference to frmMain) to create new MDI children. Quote
EricDotNet Posted March 24, 2004 Author Posted March 24, 2004 Open frmA Coding : Dim childForm As New frmMain childForm.MdiParent = Me childForm.Show() Open frmB Coding : Dim childForm As New frmMain childForm.MdiParent = [u]Me.parent[/u] childForm.Show() Since I open the frmB at frmA button, the system prompt error msg: An unhandled exception of type 'System.InvalidCastException' occurred in CeicSystem.exe Additional information: Specified cast is not valid. I debug the program, the error is happened at : childForm.MdiParent = Me.parent :confused: Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.