CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2005
    Posts
    1,828

    Enabling / Disabling Menus

    In my C# Windows application I have some menus attached like this

    As you can see I have 4 menus disabled by default. Now what I want is enable / disable them on run time. So when the user selects login from User Section it should enable those menus after successful login and similarly disabled on logout. So what is the procedure to enable / disable some section of menus at run time?

    Thanks in Advance
    Attached Images Attached Images  

  2. #2
    Join Date
    Feb 2012
    Location
    Strasbourg, France
    Posts
    116

    Re: Enabling / Disabling Menus

    Is this something like this you want ?
    Attached Images Attached Images  

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Enabling / Disabling Menus

    Instead of handling the Click event, consider handling the MenuActivate event.

    The reason is the Click event only works for the mouse (and what if the user is using a keyboard to invoke the menu?). The MenuActivate event works for both keyboard and mouse.

  4. #4
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Enabling / Disabling Menus

    Quote Originally Posted by maverick786us View Post
    In my C# Windows application I have some menus attached like this

    As you can see I have 4 menus disabled by default. Now what I want is enable / disable them on run time. So when the user selects login from User Section it should enable those menus after successful login and similarly disabled on logout. So what is the procedure to enable / disable some section of menus at run time?

    Thanks in Advance
    I would hide menue points that are not used in a given form. When some changes occur and the other menueheaders are needed, then I would make them visible. Different buttons in a menue I would disable. This creates a menue which seems to change depending on the users needs and gives it a professional touch
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured