473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

menuitem is an object ??

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 ??
Nov 21 '05 #1
6 1512
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" <ag***@dynamictech.com.hk> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
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 ??

Nov 21 '05 #2
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
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl... 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 ??

Nov 21 '05 #3
* "Imran Koradia" <no****@microsoft.com> scripsit:
For each Item As MenuItem in Me.Menu.MenuItemCollection


'...in Me.Menu.MenuItems'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4
oops..sorry. Thanks for pointing that out, Herfried :)

Imran.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2p************@uni-berlin.de...
* "Imran Koradia" <no****@microsoft.com> scripsit:
For each Item As MenuItem in Me.Menu.MenuItemCollection


'...in Me.Menu.MenuItems'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5
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

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> ¦b¶l¥ó
news:ev*************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
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
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
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 ??


Nov 21 '05 #6
As suggested in other posts use a HashTable. You can use the MenuTagger code
on my site to give a Tag property to all menuitems, but to be honest, it's
just as easy to use a HashTable directly.
http://dotnetrix.co.uk/menus.html

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
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

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> ¦b¶l¥ó
news:ev*************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
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
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
> 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 ??
>
>



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dan H | last post by:
I'm trying to add menu items dynamically in the Popup event of a MenuItem in an MDI child form. Actually, I'm using the Genghis MRU class, but have also dumbed it down to a simple test case in a...
9
by: Rakesh | last post by:
Hi, I am able to obtain a MenuItem object's Name property @ design-time, but am not able to get the same @ run- time...why? And since MenuItem doesn't inherit from Control class, it's not...
1
by: Tim Haughton | last post by:
Like most fans of eye candy, I've always thought the standard MainMenu control was a bit drab. After looking at third party components, I decided to see if I could brute force it into looking nice....
4
by: Jesper | last post by:
Hi, When creating a popup menu I find it rather difficult to provide the eventhandler for the MenuItem with enough information. My actual problem is that I create a popup menu with a list of...
6
by: Claus Holm | last post by:
I'm trying to enable a menuitem in the parent form from a mdichild. Rather than making the menuitems public, I'd go for a public method in the parent form to do the change, but when I call the...
4
by: Eric Sabine | last post by:
I've simplified the code to the following. I'm just overlooking something very simple I'm sure. Dim mic() As MenuItem mic = New MenuItem(3) {} mic(0) = New MenuItem("a") mic(0).Index = 1 ...
15
by: Jeff Mason | last post by:
I have an application where I need to set certain menu items invisible based on a user privilege. We did a sinmlar thing in VB6 and used the menu item's tag property to assign an identifier to...
4
by: Jeff Mason | last post by:
I have an application where I need to set certain menu items invisible based on a user privilege. We did a sinmlar thing in VB6 and used the menu item's tag property to assign an identifier to...
1
by: Carl Ganz | last post by:
I'm trying to build a MenuItem object in a web service and return it to the proxy. Something like this: public MenuItem GetReportMenu() { MenuItem oMenuItem = null; oMenuItem = new...
2
by: polocar | last post by:
Hi, I'm writing a program using Visual C# 2005 Professional Edition, and I was trying to assign multiple MainMenu objects (one by one, of course) to the same Form (let's suppose 2 MainMenu...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.