none
Collect Menu/Submenu/Popupmenu items RRS feed

  • Question

  • Dear Sir,

    I am using VS2005 and SQL Server2000

    I have a project where lot of Menu/Submenu/Popupmenu items. Now I want to have all Menu/Submenu/Popupmenu items in a list box of the project.

    I want to do this for create user access control to my project. so that selective group can access selected feature and Menu/Submenu/Popupmenu items.

    How can I do this ?????? / or is there any other way to control this access????

    Saturday, September 18, 2010 4:41 AM

All replies

  • That is not simply copy and paste, you need a seperate class for that with all your items.

    Also you need a kind of user (or role) class which holds the users. 

    In the role those menu items can be a property of the user (or role) class.

    When the user starts is the first thing to evaluate the settings in that property and set the menu according to that.

    You have to put those users and roles of course also in your database as entities (tables) and have functions to manage those.

     

     

     


    Success
    Cor
    Saturday, September 18, 2010 7:17 AM
  • Thanks for your prompt reply.

    I understood the thing u want to say. But I would like to request u that have you any sample code/Example project / sample class / sample links etc. by which I can set my project???

    Saturday, September 18, 2010 7:54 AM
  • Hi,

     

    You can create a role table for the users. When user signs in, check his information from the database and find his role information. On the form side, show or hide the menus according to user role.

     

    I wrote a simple guide line in this thread: http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/fc6be521-67cd-44a5-b83b-b336ed8d82fe

     

    Here is also a role control example in Code project: http://www.codeproject.com/KB/database/AppRole.aspx

     

    To get all menus list, you need to go throw all controls on the form. But I think you’d better set the menu visible property according to users’ role. You may need to spate

     

    The following is an example about how to go through all the controls in the form. According to your requirement, you need to check whether this control is typed of toolStripMenuItem.

    http://www.dreamincode.net/code/snippet1663.htm

     

    Hope this helps

     

    Have a nice day.

     

    Best regards,

    Ling Wang

     

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Wednesday, September 22, 2010 8:09 AM
    Moderator
  • Hai Sir,

    I have gone through with the link

    http://www.codeproject.com/KB/database/AppRole.aspx

    and download it but it is showing in my computer that this is unrecognize version of Visual studio project.

    For your info. I am using VS2005.

    Have u any code of above project? If yes, Can u give it to me. So that I can follow.

    Sunday, September 26, 2010 3:57 AM
  • Hi,

     

    I have shown you details steps in Links of my last reply. It is not hard to follow. You can try it.

     

    If there is anything unclear, please feel free to ask.

     

    Best regards,

    Ling Wang


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Monday, September 27, 2010 3:06 AM
    Moderator
  • Hi wang,

    I have followed the steps shown by you. But I have another problem now

    When I entered to the HRIS only then I have to put ID/password/Group information

    Then in the HRIS when I click on Duty Roster Management Menu then run/open the DutryRoster.exe

    Now how can I setup Duty Roster menus Active/Inactive based on the user group  which I was selected when I entered to the HRIS.

    if it is not clear then When I want to run Duty roster exe then it will collect user group information from HRIS exe and set its menus active inactive accordingly.

    FYI, I have made grouptable and stored form name with active inactive information.

    Hope it is clear to u.

    Saturday, October 2, 2010 4:28 AM