Click here to Skip to main content
Licence 
First Posted 7 Feb 2004
Views 58,313
Bookmarked 29 times

Dynamic MainMenu formation in Winform Application using XML - Part 2

Dynamic MainMenu formation in Winform application using XML.

Introduction

In my preivious article, I explained how we can form a dynamic menu using XML. That is a very basic method. There we cannot do any validation like MenuItem enable or disable, icon setting and etc. In this article, I extend the XML usage.

Building Menu

I have changed the XML format. The following is the XML file format:

<Records>
<MenuItem>
<MenuID>FILE</MenuID>
<MenuName>File</MenuName>
<MenuParent></MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>NEW</MenuID>
<MenuName>New</MenuName>
<MenuParent>FILE</MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>OPEN</MenuID>
<MenuName>Open</MenuName>
<MenuParent>FILE</MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>EXIT</MenuID>
<MenuName>Exit</MenuName>
<MenuParent>FILE</MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>DOC</MenuID>
<MenuName>Document File</MenuName>
<MenuParent>NEW</MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>TXT</MenuID>
<MenuName>Text File</MenuName>
<MenuParent>NEW</MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>HTML</MenuID>
<MenuName>HTML File</MenuName>
<MenuParent>NEW</MenuParent>
<Enable>N</Enable>
</MenuItem>
<MenuItem>
<MenuID>EDIT</MenuID>
<MenuName>Edit</MenuName>
<MenuParent></MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>COPY</MenuID>
<MenuName>Copy</MenuName>
<MenuParent>EDIT</MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>PASTE</MenuID>
<MenuName>Paste</MenuName>
<MenuParent>EDIT</MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>HELP</MenuID>
<MenuName>Help</MenuName>
<MenuParent></MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>HHELP</MenuID>
<MenuName>Help</MenuName>
<MenuParent>HELP</MenuParent>
<Enable>Y</Enable>
</MenuItem>
<MenuItem>
<MenuID>ABOUT</MenuID>
<MenuName>About</MenuName>
<MenuParent>HELP</MenuParent>
<Enable>Y</Enable>
</MenuItem>
</Records>

I have changed the CreateMenuItems little bit to use DataSet.

Code

The menu will be shown like:

Menu Design

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:48 4 Dec '09  
GeneralSeperator in Menu PinmemberGaurav Rathod18:19 9 Nov '04  
QuestionWebForm instead of WinForm? PinsussAnonymous17:24 16 Jun '04  
QuestionPrevious article? Pinmembernetclectic3:39 10 Feb '04  
GeneralThoughs about the XML syntax PinmemberRui Dias Lopes12:43 9 Feb '04  
GeneralRe: Thoughs about the XML syntax PinmemberAmalorpavanathan Yagulasamy(AMAL)7:23 10 Feb '04  
GeneralRe: Thoughs about the XML syntax Pinmemberb0ksah3:38 19 Mar '07  
QuestionWhat is the advantage of dynamic mainmenu? PinmemberFranz Wong3:52 9 Feb '04  
AnswerRe: What is the advantage of dynamic mainmenu? PinmemberAmalorpavanathan Yagulasamy(AMAL)7:47 9 Feb '04  
GeneralRe: What is the advantage of dynamic mainmenu? Pinmemberaatanw22:37 28 Jun '04  
GeneralMight I suggest... PineditorMarc Clifton10:21 8 Feb '04  
GeneralRe: Might I suggest... PinmemberAmalorpavanathan Yagulasamy(AMAL)12:04 8 Feb '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 8 Feb 2004
Article Copyright 2004 by Amalorpavanathan Yagulasamy(AMAL)
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid