menuitem is an object ??

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

dim c as controls
for each c in me.controls
messagebox.show(c.name)
next c

I found that the menu time didn't show up ?? It didn't belongs to the
control in the form ???
I need to Me.mnuXXX.Enabled = false during run-time
Anyone know how can do that ??
 
You do something like:
For each Item As MenuItem in Me.Menu.MenuItemCollection
If <condition> Then
Item.Enabled = False
End If
Next Item

hope this helps..
Imran.
 
Agnes,
As Imran suggests.

MenuItem is an object, however it is NOT a control.

Your form has both a Menu property that is the main menu, and a ContextMenu
(inherited from Control) that is used for context menus.

You need to use the MenuItems collection of the respective menu.
I need to Me.mnuXXX.Enabled = false during run-time
Anyone know how can do that ??

Have you tried?

Me.mnuXXX.Enabled = False

Or are you wanting to dynamically set a menu.Enabled to false based on a
string? Remember MenuItems don't have names exposed at runtime (they are
compile time only).

Hope this helps
Jay
 
Thanks for all reply.
Menuitems don't have a name at runtime?! My god. It is a must that I need to
disable some menuitem during run-time. My approach is "My application got
one menu bar , every user got its security tables, he/she got different
permission in each forms. e.g Invoicing , user A allows to use invoice, but
not user B'

As userB Login the application, i need to disable the 'Invoice menu' .
HOWEVER, I can't use the menuitem.text becauese the menu item will be
displayed in GB or B5, or English.
May be I need to change my security design....
From AGnes
 

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

Back
Top