Menu Item Name?
-
how can i access the Menu Item Name Property through code:confused: :confused:
-
how can i access the Menu Item Name Property through code:confused: :confused:
-
If you have added a contextmenu on your form, you should be able to access to each menu item's property eg: menuitem1.text = "Hello!"
I want to access Name Property my code is as:
Dim mnuItem As MenuItem For Each mnuItem In OfrmMain.mnu_Main.MenuItems If **mnuItem.Name** ="NameofMenu" Then 'Do some thing End If Next
Regards -
I want to access Name Property my code is as:
Dim mnuItem As MenuItem For Each mnuItem In OfrmMain.mnu_Main.MenuItems If **mnuItem.Name** ="NameofMenu" Then 'Do some thing End If Next
RegardsHello Javed! you have confused me! :)) Your code is okay there is no error. If your are still not able to get the menu name that means you have to check your contextmenu name to make sure you are tryign to use the right menu collection. mnuItem.Name must return a value as you have defined in your code. If you have more than one menu collection make sure you have pointed to right collection. Otherwise, re-check the menu name which you have tried in seeking its equality to mnuItem.Name.. Take it easy!
-
Hello Javed! you have confused me! :)) Your code is okay there is no error. If your are still not able to get the menu name that means you have to check your contextmenu name to make sure you are tryign to use the right menu collection. mnuItem.Name must return a value as you have defined in your code. If you have more than one menu collection make sure you have pointed to right collection. Otherwise, re-check the menu name which you have tried in seeking its equality to mnuItem.Name.. Take it easy!
My Friend Problem is this that Menu Object dos't expose the "Name" Property.... Regards :^)
-
I want to access Name Property my code is as:
Dim mnuItem As MenuItem For Each mnuItem In OfrmMain.mnu_Main.MenuItems If **mnuItem.Name** ="NameofMenu" Then 'Do some thing End If Next
RegardsOf course. There is no Name property for a
MenuItem
. If you can't set one, why would you be looking to read it? You can, however read its Text property. Doing what you're looking at in your sample code is not good practice. Each menuitem should handle its own Click event. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome -
Of course. There is no Name property for a
MenuItem
. If you can't set one, why would you be looking to read it? You can, however read its Text property. Doing what you're looking at in your sample code is not good practice. Each menuitem should handle its own Click event. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming GnomeThanks for ur response. Actually i want to implement user security. My working is as: I will make Roles and Role will be given rights to access "MENU" and user will be assign the role. Now i want to write a code which show all the menus in a grid i want to save the NAME of the MENU in a hidden column which will be saved in the database. Now i have decided to save the Menu Text in database which i know can cause problem becuase if menu text is changed it will have to be changed in database too. As menu item name is not changed so if it is saved it will cuase no problem... hope u will have got my point if u have any better suggestion will be benificial for me. Regards Javed