By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,400 Members | 1,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,400 IT Pros & Developers. It's quick & easy.

VB.NET Menu Item question

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
<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

P: n/a
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.