VB.NET Menu Item question

S

simchajoy2000

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
 
A

Armin Zingler

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
 
C

Cor Ligthert

Hi Armin,
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top