aj85
asked on
MenuStrip Component VB.NET
I am using the menustrip component in a VB.NET application that I have. There are about 25 menu items, and I do not want to put them all in separate Subs, as they can be easier to maintain by using a Select Case statement, and using the Index or text for each menu. I have tried several different approaches to this, but the menu items are not getting called when the menu item is clicked.
Can someone provide an example of using a Select Case with the Menustrip component, and several menu items?
Regards,
aj85
Can someone provide an example of using a Select Case with the Menustrip component, and several menu items?
Regards,
aj85
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello Andy/Saige,
Thank you both for your solutions, as you were correct it was a better approach. I would have liked to use the select case for the number of current and future menu items that I have, but in the end it was much easier to take your advice. : ) Thanks again.
Regards,
aj85
Thank you both for your solutions, as you were correct it was a better approach. I would have liked to use the select case for the number of current and future menu items that I have, but in the end it was much easier to take your advice. : ) Thanks again.
Regards,
aj85
Two ways to do it.
ASKER
Thanks for your response, I will try your suggestion. Can you also tell me if you know how to get just the name or text of the menu item being selected? Meaning that if I have a top level called "File" with sub-menu items of "Edit"->"Print", and have another sub-menu item on the "Print" level, such as "Print"->"Print Preview", and I want the name or text label of the "Edit" and "Print Preview" menu items, how can I retrieve that information?
Regards,
aj85