468,471 Members | 1,770 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,471 developers. It's quick & easy.

VB.NET Menu Item question

I have a menu bar that I initialize in Private Sub
InitializeComponent() and then later on in my code, depending on
different conditions, I need to be able to disable some of the menu
items programmatically. I am able to set the visibility for the menu
item to false and it works correctly but for some reason, it won't
work if I try to set the enabled property to false. Here is my code:

Dim m As MenuItem = mainMenuBar.MenuItems.Item(1)
Dim n As MenuItem = m.MenuItems.Item(2)
n.Visible = False
n.Enabled = False

Does anyone know what I am doing wrong or why this is not working??
Thanks!!

Joy
Nov 20 '05 #1
2 1269
<si***********@yahoo.com> schrieb
I have a menu bar that I initialize in Private Sub
InitializeComponent() and then later on in my code, depending on
different conditions, I need to be able to disable some of the
menu items programmatically. I am able to set the visibility for the
menu item to false and it works correctly but for some reason, it
won't work if I try to set the enabled property to false. Here is my
code:

Dim m As MenuItem = mainMenuBar.MenuItems.Item(1)
Dim n As MenuItem = m.MenuItems.Item(2)
n.Visible = False
n.Enabled = False

Does anyone know what I am doing wrong or why this is not working??
Thanks!!


Hmm...how can you see whether an invisible item is enabled?
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Hi Armin,
Dim m As MenuItem = mainMenuBar.MenuItems.Item(1)
Dim n As MenuItem = m.MenuItems.Item(2)
n.Visible = False
n.Enabled = False

This is really your stuff, maybe by clicking on the place where you expect
it?

(Open question, just a gues, but as I said this is your stuff in my opinion)

Cor
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Mohit Gupta | last post: by
2 posts views Thread by Sisnaz | last post: by
5 posts views Thread by yxq | last post: by
1 post views Thread by Kayvine | last post: by
1 post views Thread by Dave | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.