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

  • SEARCH
  • Home
  • 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 8207835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:07:45+00:00 2026-06-07T09:07:45+00:00

For my current project i made a MDIform with menuStrip and a couple of

  • 0

For my current project i made a MDIform with “menuStrip” and a couple of “ToolStripMenuItem”.
a couple of buttons and a devexpress “NavbarControl”

The intention is that the user logs in with a userID
the application will get a datarow for a specific “Control”
in this row theirs a bool, if its true the Item must be visible, otherwise the item must be invisible.

the Datarow also contains the name of the item.

so i uses:

this.Controls[item].Visible = true;

item = string(name of item)

if i use this to hide the menustrip itself, it works
if i try it on the MenuStipItems, it gives a null reference exception.

how can i control the items INSIDE the MenuStip, only by name of the item???

Code:

    DataTable dt = GetData();
    foreach (DataRow row in dt.Rows)
    {
        string item = row["ItemNaam"].ToString();
        foreach (string rol in Rollen)
        {
            DataRow dr = GetDataByItemNaam(item);
            if (Convert.ToBoolean(dr[rol]) == true)
            {
                this.Controls[item].Visible = true; //Show Item
            }
        }
    }
  • 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-06-07T09:07:47+00:00Added an answer on June 7, 2026 at 9:07 am

    I’ve solved the problem:

    I created a foreach loop within a foreach loop where
    each loop looks for the name of the item, and then for the name of the item in the previous item.
    If the name matches the given name, it sets the visibility to true.

    This is for 2 levels, I created an additional two extra foreach loops to go even deeper (inception) to 4 levels of items in the menu.

    Perhaps its not the right/fastest way, but it works like it should.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement unit tests in my current project. After that I'll start
Our current project is made up of Python2.3 and wxPython-2.4.1.2. It is working fine.
I'm writing tests for my current project, made with Zend Framework. Everything's fine, but
I'm dealing with an issue with my current employer that has seriously made me
My current project structure is made to do logging of exceptions and such into
I have made a project to display world weather at current time. In my
In my project I made some changes that nothing works now. I cannot find
My current project is broken down into 3 parts: Website, Desktop Client, and a
Our current project has ran into a circular dependency issue. Our business logic assembly
My current project involves using LDAP (Active Directory) and I'm using issue tracking for

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.