Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Posted

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.

Posted

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:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...