Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Toolbar buttons and menu items dissappeared
 

Toolbar buttons and menu items dissappeared

I have a huge problem. After deleting some images from the resources in my application, all my toolbar buttons and menu items have disappeared. I use Visual Studio 2008.I might have destabilized the designer somehow. But the designer generated code has remained intact. Why then can't i see the buttons anymore? Is there a way to remedy this? I have already recreated all buttons and menu items, and it's a lot of work. Hope someone can help.
Stardust1611  Thursday, April 09, 2009 4:01 PM

Hi Stardust1611,

Look at this code,
this.btnNew.Image = ((System.Drawing.Image)(resources.GetObject("btnNew.Image")));
I guess the btnNew is your toolstripbutton which still get the image from your resource. While the image is gone, it cannot get it from resource. Please try to delete this code, also for "btnOpen", "btnSave", "btnUndo", "btnRedo".

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
  • Marked As Answer byStardust1611 Tuesday, April 14, 2009 7:26 AM
  •  
Kira Qian  Tuesday, April 14, 2009 2:52 AM

Hi Stardust1611,

Do you use the image in the resource as the Image of ToolStrip button? If you did so and delete the image from the resource in the VS designer, it cannot locate them and popup error at design time. Also it will raise error when compiled. If you delete these image file in Windows Explorer, you won't lose these image on ToolStripButton.

Do you bind your code to a source control? If so, you need to roll back to a previous version(before you delete resource) to get them back.

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Monday, April 13, 2009 3:17 AM
I posted the same question here: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/e1525d6b-09f1-4e39-9f1d-20f0fe4f4c12and got some answers, and the problrm is described better. You can even see the designer source code. If you have any idea why the toolbarbuttons are missing even if i copy the designer generatedcode into a new project, please tell me. What is missing in that code?
Stardust1611  Monday, April 13, 2009 6:51 PM

Hi Stardust1611,

Look at this code,
this.btnNew.Image = ((System.Drawing.Image)(resources.GetObject("btnNew.Image")));
I guess the btnNew is your toolstripbutton which still get the image from your resource. While the image is gone, it cannot get it from resource. Please try to delete this code, also for "btnOpen", "btnSave", "btnUndo", "btnRedo".

Sincerely,
Kira Qian


Please mark the replies as answers if they help and unmark if they don't.
  • Marked As Answer byStardust1611 Tuesday, April 14, 2009 7:26 AM
  •  
Kira Qian  Tuesday, April 14, 2009 2:52 AM

You can use google to search for other answers

Custom Search

More Threads

• Build Dynamic Menu Strip
• Auto Format
• TabControl and Images not showing
• windows control library developed in vb.net(window application) can be used in asp.net(web application)
• Using IMenuCommandService
• addition date
• Open Form
• How to redraw user control's contest
• Custom toolbar control in .Net framework
• Handling control non-client area in the designer