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

Replacing MainMenu Controls With VS2005 MenuStrip Controls

, 27 Feb 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
Code to do an automated replace of the MainMenu controls

Introduction

If you (like us) have VS2003 code that uses MainMenu controls you would have noticed how forms grow by themselves when opened in the VS2005 designer, and may have also decided that it is time to upgrade to the newer MenuStrip control - as Microsoft is obviously hinting should be done. Doing each form by hand will be a tedious and time-consuming process if you have many forms with MainMenus on (we have 283).

Time for a quick program...

Using the code

This is a very "quick and dirty" little program that will do the replacement for you if there are many forms that have MainMenu controls. It is written in VB for VB.NET code, so anyone using C# will need to translate it for C# syntax.

Use at your own peril, and remember to make a backup before running it Wink | ;)

Known issues

The code will set the shortcut key of menu items - this will work in runtime, but if your code uses the System.Windows.Forms.Shortcut enum this will need to be changed to use the Windows.Forms.Keys enum to open the form in the designer.

Points of Interest

This CodeProject Article: UpgradeToMenuStrip.aspx by Jim Hollenhorst details what needs to be done manually - this project doesn't do everything recommended in it, but should act as a good starting point for anyone with many forms that need to be fixed.

History

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Bryan Symons
Software Developer (Senior) SDT
South Africa South Africa
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 27 Feb 2008
Article Copyright 2008 by Bryan Symons
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid