Hi there.
I have an app that has several menus. I want that when a certain menuItem(s) is/are selected other menuItems are disabled. For instance, if a user selects menuItem2 I want menuItems 10, 12 and 17 to be disabled. How do I go about coding that?
I know about Enable = false but I don´t know how to code: if such and such menuItems are selected then such and such menuItems are to be disabled.
Thanks,
Loading
AnttiPosted Dec 4, 2005, 4:58 PM
Ok, you must do event handler for menus. You can add Collapse event handler for menu itself, and then test if the menuitems are being selected.
Or you can do Click event handlers for each menuitems that must have special functionalities.
When you need to know if some menuitem if checked (you can check menuitems like checkboxes), just inspect menuitem.Checked property.
If you click some menuitem, sender object that is passed to the event handler tells you which menuitem was that raised the event. You can cast the sender object to MenuItem object and use its properties and methods normally.
Menu has collection which contains all the menuitems, that you can iterate through to get all the menuitems in the menu that are selected.
I can't offer you any code, because i haven't got development tools on this machine, and i don't remember all of C# by memory (Visual Studio has that kind of an effect sometimes;))