Click here to Skip to main content
Licence 
First Posted 27 Jan 2004
Views 44,220
Bookmarked 19 times

Dynamic MainMenu formation in Winform Application using XML

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

About the Author

Amalorpavanathan Yagulasamy(AMAL)

Web Developer

United States United States

Member

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

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralYes,Very Useful... Pingroupchinesedragon14:30 4 Dec '09  
GeneralThank you Pinmembervmo3d5:54 13 Sep '06  
GeneralDynamic Event Handling PinmemberAekeh4:05 28 Jul '06  
QuestionXML used poorly? Pinmemberdog_spawn8:45 6 Feb '04  
AnswerRe: XML used poorly? PinmemberAmalorpavanathan Yagulasamy(AMAL)18:36 6 Feb '04  
GeneralImages still pointing to local files Pinmemberpartyganger20:28 28 Jan '04  
GeneralRe: Images still pointing to local files PinmemberAmalorpavanathan Yagulasamy3:49 29 Jan '04  

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.

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