Click here to Skip to main content
Click here to Skip to main content

Dynamic MainMenu formation in Winform Application using XML

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

Introduction

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,
CreateMenu
CreateMenuItem
CreateMenuItems
and one event.
Menu_Click

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. The following figure shown the XML file format.

XML

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

Code

The menu will be shown like,

Menu Design

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

Menu Event

Finally

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

License

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

Share

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 amal_forum@hotmail.com

Comments and Discussions

 
GeneralYes,Very Useful... Pingroupchinesedragon4-Dec-09 14:30 
GeneralThank you Pinmembervmo3d13-Sep-06 5:54 
GeneralDynamic Event Handling PinmemberAekeh28-Jul-06 4:05 
QuestionXML used poorly? Pinmemberdog_spawn6-Feb-04 8:45 
AnswerRe: XML used poorly? PinmemberAmalorpavanathan Yagulasamy(AMAL)6-Feb-04 18:36 
GeneralImages still pointing to local files Pinmemberpartyganger28-Jan-04 20:28 
GeneralRe: Images still pointing to local files PinmemberAmalorpavanathan Yagulasamy29-Jan-04 3:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.8.140814.1 | Last Updated 5 Feb 2004
Article Copyright 2004 by Amalorpavanathan Yagulasamy(AMAL)
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid