Home All Groups Group Topic Archive Search About

MenuStrip Submenu Items

Author
9 Feb 2006 3:53 AM
ShaneO
Probably a stupid question, but I can't seem to find how to
Enable/Disable Submenu items within a MenuStrip.

File
-Open
-Save
..
..


I know how to do it in a ContextMenuStrip as -

ContextMenuStrip1.Items.Item(Name).Enabled = False

but MenuStrip1.Items.Item("Open").Enabled = False doesn't work.

Any help appreciated.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.

Author
9 Feb 2006 4:32 AM
Jim Wooley
Hello ShaneO,

> Probably a stupid question, but I can't seem to find how to
> Enable/Disable Submenu items within a MenuStrip.
>
> File
> -Open
> -Save
> .
> .
> I know how to do it in a ContextMenuStrip as -
>
> ContextMenuStrip1.Items.Item(Name).Enabled = False
>
> but MenuStrip1.Items.Item("Open").Enabled = False doesn't work.

Each MenuStrip item is declared as it's own entity. By default it takes the
name of the Text and "ToolStripMenuItem". In your case, your object may be
named "OpenToolStripMenuItem". You can simply set OpenToolStripMenuItem.Enabled=False.

Jim Wooley
Author
9 Feb 2006 4:39 AM
ShaneO
Jim Wooley wrote:
Show quoteHide quote
> Hello ShaneO,
>
>> Probably a stupid question, but I can't seem to find how to
>> Enable/Disable Submenu items within a MenuStrip.
>>
>> File
>> -Open
>> -Save
>> .
>> .
>> I know how to do it in a ContextMenuStrip as -
>>
>> ContextMenuStrip1.Items.Item(Name).Enabled = False
>>
>> but MenuStrip1.Items.Item("Open").Enabled = False doesn't work.
>
>
> Each MenuStrip item is declared as it's own entity. By default it takes
> the name of the Text and "ToolStripMenuItem". In your case, your object
> may be named "OpenToolStripMenuItem". You can simply set
> OpenToolStripMenuItem.Enabled=False.
>
> Jim Wooley
>
>
Hello Jim,

Thank-you very much for your assistance.  As I thought, it was stupid
question, but I just couldn't see the forest for the trees! (You
wouldn't believe how long I spent on this, and all the Googling in the
world didn't seem to help!!!)

Thanks again.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.