Advertisement

06.26.2008 at 10:27PM PDT, ID: 23520673
[x]
Attachment Details

Allowing / Restricting access to MenuItems

Asked by Mr_Fulano in Microsoft Visual Basic.Net

Hi, I have a VB.NET 2005 application that has a Main Menu Tool Strip at the top. Depending on the type of user that logs in, the user will see (or not see) different menu items and sub items available. If you're an Administrator, you see everything. If you're a Basic user, you see only some sub-items.

For conservation sakes, lets say I have two levels of users (Admin and Basic). Currently I used the code below in a Subroutine, which I call from the main form's Load event. This works, but my question is the following....Is there a more elegant and effective way to do this?

Ideally, if I had a list, where I could add the menu items that each user could see, that might be more effective...I think. What are your suggestions?

Thanks,
Fulano
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
Private Sub provideAccess()
        If g_strRights = "Admin" Then
            Item_1_ToolStripMenuItem.Visible = True
            Item_2_ToolStripMenuItem.Visible = True
        Else
            Item_1_ToolStripMenuItem.Visible = False
            Item_2_ToolStripMenuItem.Visible = False
        End If
    End Sub
[+][-]06.26.2008 at 11:10PM PDT, ID: 21881255

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Sign Up Now!
Solution Provided By: appari
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.27.2008 at 04:07AM PDT, ID: 21882408

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.28.2008 at 10:08AM PDT, ID: 21891420

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 09:52AM PDT, ID: 21894612

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 10:06AM PDT, ID: 21894665

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.29.2008 at 05:06PM PDT, ID: 21896000

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.01.2008 at 09:03PM PDT, ID: 21913361

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628