Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / December 2006

Tip: Looking for answers? Try searching our database.

Menu items disappearing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Veeneman - 30 Dec 2006 23:48 GMT
This item is for the Google archive and requires no response.

The VS 2005 Windows Forms Designer has an annoying bug that causes all menu
and toolbar items to disappear if an entry is deleted from the project RESX
document. It may happen at other times, as well, but this is when I've run
into it.

My first reaction was "Holy #$%*! I've got to recreate my menus and
toolbars! There's an afternoon down the tubes!" But it turns out things
aren't quite that bad. The menu and toolbar items weren't trashed by the
designer--only the code in the designer that adds the items to their
containers (menus to the menu bar, and toolbar items to toolbars).

To restore the items, go into the designer code for the form affected. Look
for the section that sets properties for the menu or tool bar you need to
restore. You would normally a statement at the top of the section that looks
something like this:

           //
           // menuStrip1
           //
           this.menuStrip1.Items.AddRange(new
System.Windows.Forms.ToolStripItem[] {
           this.menuFile,
           this.menuEdit,
           this.menuFormat,
           this.menuTools,
           this.menuHelp});

That's what was trashed by the Designer. You will need to recreate the
statement by hand. Do that for the main menu (only the menu strip--the
individual menus are okay) and for each toolbar in the application. You
won't need to add tool strip separators back to the main menu (since the
menus themselves weren't trashed), but you will need to add them back to the
toolstrips. Start from the highest-number toolStripSeparator you find in the
designer and work your way backward--that will avoid adding any of the menu
separators a second time.

It took about fifteen minutes to restore my form. It sure beats the heck out
of spending the afternoon recreating menus and toolbars!

David Veeneman
Foresight Systems
RobinS - 31 Dec 2006 00:43 GMT
Were the items still on the form itself, and they were only
mucked up in the designer file? Or were they missing from the
form? Did you try just re-generating the designer file?

Robin S.
--------------------------------------
> This item is for the Google archive and requires no response.
>
[quoted text clipped - 41 lines]
> David Veeneman
> Foresight Systems

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.