CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Posts
    4

    Displaying an MDIChild form

    Hi all,

    I am developing a small application with VB 2005.

    The application uses a 'main' MDI form (frmMain) within which I want 4 MDI children forms are to be displayed. The user clicks 'New Registration' menu and the first form displays on the parent form (this is happening, fine), after completing this form, the user then clicks the 'Next' button to open the 2nd form (*this isn't happening, problem!).

    My code to open the 2nd form looks like:

    ....btnNext_Click(...)...

    Dim SecondForm as New frmSecond

    Me.Hide/Me.Close 'I tried both

    SecondForm.MDIParent = frmMain
    SecondForm.Show()

    End Sub

    The current form closes or hides but the SecondForm does not appear. What could be the problem here?

  2. #2
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    Re: Displaying an MDIChild form

    I don't think the reference to frmMain is in scope. Try it like this:

    Code:
    SecondForm.MDIParent = Me.MDIParent
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  3. #3
    Join Date
    Jan 2007
    Posts
    55

    Re: Displaying an MDIChild form

    HairyMonkeyMan
    is right,that must solve your problem

  4. #4
    Join Date
    Dec 2008
    Posts
    4

    Re: Displaying an MDIChild form

    Thanks guys. I was away and only got your replies today. I am going to try that and see if it works.

    Actually, When the application uses a Login form as its start-up form that is when it gives problems displaying the other forms on the main (MDI Parent). When I use the main form as the start-up form all other forms are displayed with no problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured