Click here to Skip to main content
11,924,487 members (56,123 online)
Click here to Skip to main content
Add your own
alternative version


62 bookmarked

Dynamic MainMenu formation in WinForm Application using DataSet

, 24 Feb 2004
Rate this:
Please Sign up or sign in to vote.
Dynamic MainMenu formation in WinForm application using DataSet.

Sample Image - DynamicMenuDataSet.jpg

Table Of Contents


This article demonstrates, how to form the Main menu through database based on given login user. Here I have given the table model and menu formation method. As in the previous article, which discussed XML driven menus generated at runtime, this article focuses on building menu through DataSet.

For demo purpose, I have created the DataSet in runtime.

Menu level Security

We can give the permission to user for a particular screen or action through menu, when an application is loading itself. Like what are all the menus available to the user.

Flow for Menu level Security

The following figure shows the flow of this type of security model.


Table Design

See the table design below, I have added one column USERID. I have designed this table for demo purpose. So I didn't concern about normalization. You can design your table model, but SQL query output should be like MenuID, MenuName, MenuParent, Enable and USERID format.


Login Form

See the Login Form below, you can select a user from here.


Menu Design

The menu will be shown like for USERID='DEMO',




Recursive method

A recursive method CreateMenuItems has been used to create all the menu items. I have changed the CreateMenuItems little bit to use a DataSet.



I think this shows how you can implement the security in MainMenu through database and any help, comments are much appreciated!


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Amalorpavanathan Yagulasamy(AMAL)
Web Developer
United States United States
Amalorpavanathan Yagulasamy (AMAL) is a Software Engineer for Protech Solution Inc. and has designed and implemented projects for Arkansas Child Support, Arkansas Budgetting, Michigan Child Support , Massachusetts Child Support, National Informatics Center-India and Indian Oil Corporation. His background is in developing relational databases and n-tier applications on Windows platforms in CMM Level Standards. He can be reached at

You may also be interested in...

Comments and Discussions

SuggestionModify DB Design Pin
Emmanuel Medina Lopez16-Jul-13 10:39
professionalEmmanuel Medina Lopez16-Jul-13 10:39 
Questiondatabase driven menu Pin
Namdev Karande23-Aug-12 1:06
memberNamdev Karande23-Aug-12 1:06 
GeneralIn te right direction... Pin
malharone1-Aug-05 7:47
membermalharone1-Aug-05 7:47 
Generalerror compiling solution Pin
Antonio Barros11-Jul-04 6:34
memberAntonio Barros11-Jul-04 6:34 
GeneralCool Pin
devxon18-Feb-04 6:17
memberdevxon18-Feb-04 6:17 
GeneralRe: Cool Pin
Amalorpavanathan Yagulasamy(AMAL)18-Feb-04 8:02
memberAmalorpavanathan Yagulasamy(AMAL)18-Feb-04 8:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151125.3 | Last Updated 25 Feb 2004
Article Copyright 2004 by Amalorpavanathan Yagulasamy(AMAL)
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid