Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 359091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:21:40+00:00 2026-05-12T12:21:40+00:00

I need to develop a Winforms application where users are given permissions to access

  • 0

I need to develop a Winforms application where users are given permissions to access menu-items in a menu-strip as assigned to them.

I have anticipated the following technique:

(1) Menu Strip is mapped into a corresponding treeView with checkBoxes,

(2) A user is selected from the combo-box,

(3) Some tree-view-node check-boxes are checked in treeView to indicate that, “this user would be able to access these menu-items”,

(3) A save button is pressed to save the checked tree-Nodes and the user in the DB.

At later stages, when a user logs into the system, Menu-Strip items are populated accordingly from the DB.

Can anyone suggest me any better technique?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:21:40+00:00Added an answer on May 12, 2026 at 12:21 pm

    We have a similar implementation at work. This is a pretty straightforward design and works well.

    You may want to add a unique identifier to each MenuItem. This can be as simple as:

    public enum MenuItems
    {
        File_New = 100,
        File_Save = 110,
        // ...
    } 
    

    And you include this number in the database. Then, when you write out the menu items, you can have a dictionary that maps the MenuItems integer to a delegate (for handling the execute event):

    delegate void MenuItemExecuteHandler();
    IDictionary<int, MenuItemExecuteHandler> MenuItemHandlers;
    

    And somewhere define the mappings:

    MenuItemHandlers.Add(MenuItems.File_New, this.OnFileNewClick());
    

    So that when you hookup the menu item event handlers, you can call the right method to perform the right action:

    int id = 100; // Retrieved from the database.
    MenuItems menuItem = (MenuItems)Enum.TryParse(typeof(MenuItems), id);
    string command = "..."; // Retrieved from the database using the MenuItem ID.
    MenuItemControl control = new MenuItemControl();
    control.Text = command;
    control.OnClick += new EventHandler(delegate (object sender, EventArgs args) 
    { 
        MenuItemHandlers[menuItem].Invoke(); 
    });
    

    (Something to that effect, I probably have the syntax off slightly)

    Update:

    The “Tag” property of the tree-view item control gets populated like this, following the example above:

    TreeItemControl control = new TreeItemControl();
    control.Text = "New File"; // Retrieved from database.
    control.Tag = 100; // Retrieved from database.
    

    Then, when looking for what to write out:

    if (control.CheckState = CheckState.Checked)
    {
       row["MenuItemID"] = control.Tag;
       row["Allowed"] = true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 175k
  • Answers 175k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This solution doesn't have the performance you are looking for,… May 12, 2026 at 3:06 pm
  • Editorial Team
    Editorial Team added an answer TempData is session, so they're not entirely different. However, the… May 12, 2026 at 3:06 pm
  • Editorial Team
    Editorial Team added an answer The current directory is not (necessarily) the directory the .class… May 12, 2026 at 3:06 pm

Related Questions

We're writing a .NET winform application and I'm looking for options on one of
I am currently working on a VB.NET desktop application that uses .mdb (Access) database
I have to develop an application with which my client will do visual design.
I am to develop an application on windows. I have never done that before

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.