Results 1 to 5 of 5

Thread: problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    16

    Question problem

    Hello, I am new in this forum...
    I program in vb .net (very nice, but I prefer the old vb6 ), but for work I program in vb.net.
    I have a mdi program, with 1 child (configuration). I wont to disable the menuitem(of the parent) from the child, but nothing... Is possible?.
    Thanks at all...

    Ps. sorry for my ugly english...

    ps2. the code
    -------------------------------------------
    frmparent.mainmenu1.enabled=false - doesn't exist...
    -------------------------------------------
    dim parent as new frmparent()
    parent.menuitem1.enabled=false
    doesn't work
    (the syntax is ok, but it not disable the menu )
    -------------------------------------------
    Thanks!

  2. #2
    Hyperactive Member Bananafish's Avatar
    Join Date
    Jan 2001
    Posts
    394
    It's not working because yopu are disabling the menuitem in a new instance of the parent - you need to use the actual parent.

    When you open the child form, you probably use code like this...
    VB Code:
    1. Dim objForm As New frmChild()
    2.       With objForm
    3.          .MdiParent = Me
    4.          .Show()
    5.       End With

    So you should use the .MdiParent property to set the menuitem.

    In the Child form
    VB Code:
    1. Me.MdiParent.MenuItem1.Enabled = False


    Hope this helps

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    16
    Thanks for the answare...
    But...
    I have tryied the code

    Me.MdiParent.MenuItem1.Enabled = False

    but the menuitem1 is not a valid option.....
    only menu exist...

    And this is the code to open the child:

    Dim SelOper As New frmSelOp()
    SelOper.MdiParent = Me
    SelOper.Show()

  4. #4
    Hyperactive Member Bananafish's Avatar
    Join Date
    Jan 2001
    Posts
    394
    ok, you need to convert the MdiParent to the specific type of your parent form.

    Try this in the child form

    VB Code:
    1. Dim oParent As frmParent
    2.       oParent = CType(Me.MdiParent, frmParent)
    3.       oParent.MenuItem1.Enabled = False

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    16
    wow!
    it work fine!!!!
    Very thanks!!!!

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