MdiParent.Menu.MenuItems

MARCELL0US

Newcomer
Joined
Apr 5, 2003
Messages
3
Sup,

I am looking to enable/disable menu options on a parent form, from inside a child form subroutine.

After doing some searching I found that someone accomplished this by using:

MdiParent.Menu.MenuItems[0].MenuItems[0].Enabled = False

However, when I tried using this (and many variations), I got the following tooltip style pop-up message:

Property access must assign to the property or use its value

Does anyone have an info that could help a brother out?

Thanks,
 
Use parentheses instead of brackets:
Visual Basic:
MdiParent.Menu.MenuItems(0).MenuItems(0).Enabled = False

Hope this helps,
 
He might be using C# and in C# its brackets instead of ().
BTW, that code works fine for me, are you you have a menu at that position?(0,0)
 
I thought about the fact he may be using C#, but if you use his code in VB, you get the exact error message that he mentioned. That is why I assumed he was using VB.
 
Toolbar Hiding, ToolbarButton enabling

Thanks. You guys were right about the parens instead of brackets. I ended up figured it out after a couple HOURS. Grr.

I'm more comfortable in C++ but am using VB to get used to it.

Actually, I have another problem that I haven't found a solution for:

How would I go about hiding/showing the toolbar on a parent from the child form. Same for enabling/disabling buttons on that toolbar?

Thanks again,
 
You will have to cast the MdiParent property to the actual type of your form, which will enable you to access its members (such as the toolbar).

Visual Basic:
DirectCast(Me.MdiParent, Form1).Toolbar.Blah
 
Back
Top