Search code examples
visual-studiowinformsvisual-studio-2008

Visual Studio - Menu items and toolbar buttons missing after deleting a resource


Something very strange happened here in Visual Studio 2008 (C#).

After deleting an icon resource from my project all my menu items and toolbar buttons disappeared. I checked my form Designer.cs file and the code to the items are still there. Also, I tried to search for the deleted resource file name (warning.ico) in the entire solution, and nothing was found.

What happened and how can I fix this?


Solution

  • Just discovered.

    Somehow, Visual Studio messed the Designer.cs file of my form. After close inspection, the AddRange Method of my menu and toolbar was missing.

    Just fixed manually by adding:

    this.mainToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.lsbPort });