Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / Visual Basic

Replacing MainMenu Controls With VS2005 MenuStrip Controls

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
27 Feb 2008CPOL1 min read 32.6K   385   15  
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...

Image 1

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. ;)

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

  • 27th February, 2008: Initial version

License

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


Written By
Software Developer (Senior) SDT
South Africa South Africa
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --