Click here to Skip to main content
13,086,019 members (83,767 online)
Click here to Skip to main content
Add your own
alternative version


20 bookmarked
Posted 27 Jan 2004

Dynamic MainMenu formation in Winform Application using XML

Rate this:
Please Sign up or sign in to vote.
Dynamic MainMenu formation in Winform Application using XML


If our Winform application is having Menu level security, we can build the Main menu using XML in following way.

Building Menu

Like ASP.Net Tree control, we can build the Main menu using XML in runtime. For that i have created three methods,
and one event.

Here the method CreateMenu is used to create all menu items by using CreateMenuItem and CreateMenuItems.
CreateMenuItem is used to create Top level menuitems and CreateMenuItems is used to create all child level menuitems.<?xml:namespace prefix = v /><v:shapetype coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> The following figure shown the XML file format.


CreateMenuItems is a recursive method, so you can include n-level menuitems.


The menu will be shown like,

Menu Design

And Menu_Click event is used to configure the all menu item events.

Menu Event


I think this shows how you can implement the security in MainMenu 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

GeneralYes,Very Useful... Pin
chinesedragon4-Dec-09 14:30
groupchinesedragon4-Dec-09 14:30 
GeneralThank you Pin
vmo3d13-Sep-06 5:54
membervmo3d13-Sep-06 5:54 
GeneralDynamic Event Handling Pin
Aekeh28-Jul-06 4:05
memberAekeh28-Jul-06 4:05 
QuestionXML used poorly? Pin
dog_spawn6-Feb-04 8:45
memberdog_spawn6-Feb-04 8:45 
AnswerRe: XML used poorly? Pin
Amalorpavanathan Yagulasamy(AMAL)6-Feb-04 18:36
memberAmalorpavanathan Yagulasamy(AMAL)6-Feb-04 18:36 
GeneralImages still pointing to local files Pin
partyganger28-Jan-04 20:28
memberpartyganger28-Jan-04 20:28 
GeneralRe: Images still pointing to local files Pin
Amalorpavanathan Yagulasamy29-Jan-04 3:49
memberAmalorpavanathan Yagulasamy29-Jan-04 3:49 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170813.1 | Last Updated 5 Feb 2004
Article Copyright 2004 by Amalorpavanathan Yagulasamy(AMAL)
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid