Results 1 to 12 of 12

Thread: MDI & MDI Child Forms Menu's in VB2005

  1. #1
    yulyos is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    67
    Reputation
    132

    MDI & MDI Child Forms Menu's in VB2005

    Hi,

    How Do You Coordinate MDI & MDI Child Forms Menu's in VB2005

    In VB6 when you launced a MDI Child form, it's menu would appear in it's MDI Form's menu space. NOW, it Adds to the MDI Forms Menu Area.

    How can I Turn Off the MDI Form Menu before Launching the MDI Child Form?

    Remember, I want to restore it when returning from the Child Form Back to the MDI Main Form.

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    13,143
    Reputation
    1652
    If you type menustrip into the local MSDN Library index the first topic listed is merging. Clicking leads to two titles, the first of which is entitled "How to: Set Up Automatic Menu Merging for MDI Applications". Sound useful?

  3. #3
    yulyos is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    67
    Reputation
    132
    Hi,

    I have an Mdi form and he have a MenuStrip in the properties I define the
    AllowMerge=False
    In the SubMenus of the MenuStrip there is some ShortcutKeys

    I have also Child Form name Form1 and also he have a MenuStrip in the properties I define the AllowMerge=False
    In the SubMenus of the MenuStrip there is some shortcutKeys

    In the Parent Form and also in the Child Form I have some same ShortcutKeys, example: Ctrl+Z

    I wrote the next code in the Parent Form:
    For Each menuItem As ToolStripMenuItem In MenuStrip.Items
    menuItem.Enabled = False
    Next
    '
    Dim f As New Form1
    f.MdiParent = Me
    f.Show()

    When I'm loading the Child Form from the Parent Form and when I'm pressing Ctrl+Z I get the result of the action of the Parent Form

    Why?

  4. #4
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    13,143
    Reputation
    1652
    That's just plain bad programming. Under no circumstances should you have the same shortcut for more than one menu item.

  5. #5
    yulyos is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    67
    Reputation
    132
    Hi,

    Can you help me to do what I asked?

    How I add to the next code that also SubItems in the MenuStrip:
    Enabled = False

    For Each menuItem As ToolStripMenuItem In MenuStrip.Items
    menuItem.Enabled = False
    Next

  6. #6
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    13,143
    Reputation
    1652

  7. #7
    yulyos is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    67
    Reputation
    132
    Hi,

    Yes I read it.

    Can you help me to do:

    How I add to the next code that also SubItems in the MenuStrip:
    Enabled = False

    For Each menuItem As ToolStripMenuItem In MenuStrip.Items
    menuItem.Enabled = False
    Next

    Thanks

  8. #8
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,647
    Reputation
    2742
    Disabling all menu items sounds as such a bad thing to do.

  9. #9
    yulyos is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    67
    Reputation
    132
    Hi,

    Why you can't just help me with the code that I asked?

  10. #10
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    13,143
    Reputation
    1652
    I don't even know what you're asking for. Are you actually saying, without actually saying, that you want to disable every item and subitem in the menu? If so then, as JohnH says, that is just a bad idea. Some people have a problem helping someone do something that they know is a bad idea. I post on these forums to help people become better programmers. helping you write bad code doesn't achieve that so it's not something I'm going to do. If you could clearly state what it is that you're trying to achieve then we could help you come up with a proper solution, but I don't really know exactly what you're trying to achieve. I know it has something to do with menus in MDI child forms but I'm not sure exactly what. I'm fairly sure that you either want them to merge or not merge, and maybe some parent items to be hidden while a child form is displayed, but I'm really not sure. I know English is not your native language but I still don't think that you've done your best to provide a clear explanation of your aim. Without that we are really only guessing and that's a great way to watse our time providing irrelevant information.

  11. #11
    yulyos is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Jun 2004
    Location
    Israel
    Posts
    67
    Reputation
    132
    Hi,


    "it's possible that it's just a bug"

    Thank you for trying to understanding and thank you for trying to help me.

  12. #12
    Kayot is offline VB.NET Forum Enthusiast
    .NET Framework
    .NET 4.0
    Join Date
    Mar 2007
    Posts
    49
    Reputation
    97

    Concerning MDI

    Concerning MDI

    I'm not to sure what your asking, but I can give some examples.

    In VB6 mdi was handled via property's during build time. When .NET was created it became a coded property, much like the allowdrop on picture boxes.

    to open a mdi child in a mdi parent use this:

    frmForm.mdiparent = me
    frmForm.show

    to open a mdi child from another mdi child

    frmForm2.mdiparent = frmMain.Activewindow
    frmForm2.show

    ^-^ Feel free to send me a PM as I enjoy using MDI a lot and I'm sure I can help you.

Bookmarks

Posting Permissions

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