Setting MDIParent of new form

Discussion in 'ASP .Net' started by Guest, Oct 8, 2004.

  1. Guest

    Guest Guest

    Hello All,

    Having an issue with setting the MDIParent of a new form.

    I have a form called CMIMain. From this form a child form is opened called

    This is the code I use to set that up:

    Dim Form1 As New Form1
    Form1.MdiParent = Me

    Now, from Form1 I want to open another form called Form2, and I want CMIMain
    to be the parent of Form2 as well. I thought this code would work, but it
    does not:

    Dim Form2 As New Form2
    Form2.MdiParent = CMIMain

    The error I am getting says " 'CMIMain' is a type and cannot be used as an

    Any suggestions?

    Guest, Oct 8, 2004
    1. Advertisements

  2. Guest

    Dave Hall Guest

    Try replacing the problem line with this one:

    Form2.MdiParent = Me.MdiParent

    Dave Hall, Oct 11, 2004
    1. Advertisements

  3. Guest

    Chris Jobson Guest

    I'm not well up with VB.NET, but I think:
    Form2.MdiParent = MdiParent
    or, equivalently,
    Form2.MdiParent = Me.MdiParent
    will work.

    Chris Jobson
    Chris Jobson, Oct 11, 2004
  4. Guest

    Guest Guest

    Thanks Dave and Chris.

    That worked!

    Guest, Oct 12, 2004
  5. Guest


    May 6, 2012
    Likes Received:

    I just want to say thank you for the help. I found this site while searching for a solution to a similar problem
    Low_Tech_Gamer_Girl, May 6, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.