By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,080 Members | 1,748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,080 IT Pros & Developers. It's quick & easy.

menuStrip and toolStrip acting oddly after resource deletion

HaLo2FrEeEk
100+
P: 404
Ok, I have a menuStrip and a toolStrip. the menuStrip is laid out like this:

Actions
Connect
Disconnect
-
Exit

Pretty simple. The toolstrip has 1 item, a toolstripstatus. I decided I wanted to add a little icon next to the status text, so I opened up the image property in Design mode and imported 2 images. Both were PNG images and were 256x256 resolution. I decided that I wanted to use smaller versions since it was, after all, a toolstripstatus. So I deleted the 2 image resources from the solution explorer and immediately got loads of errors. Turns out the toolstripstatus was still trying to access the image resource that I deleted. No problem, I'll just manually remove that line of code from the Designer. Of course not, now I get all sorts of errors when I try to debug, something like "code generation for property 'items' failed...", and when that went away and my project actually debugs...lo and behold, I have no menustrip items OR toolstripstatus! The menu strip is still there and the toolstrip is still there...but their items are gone!

This is really frustrating because I went through ALL of my project files and looked for instances of the name of the original image I used, or even any instance of the text ".png". There were none, in any of the project files. So why am I still having this problem?!? If I look in the designer I can see that my menu strip items are in there, along with my toolstrip (even though I deleted the toolstrip from the project...) Someone PLEASE help me!
Nov 26 '09 #1
Share this Question
Share on Google+
3 Replies


Plater
Expert 5K+
P: 7,872
I think you will see for your Form an extra "sub" file in the solution explorer. It should be an extra resx file. It probably has something to do with that
Nov 30 '09 #2

HaLo2FrEeEk
100+
P: 404
I figured it out, I guess for some reason the pointers (?) to the menu items and the label in the status bar got removed from the declaration of the status bar and menustrip in the designer.cs file. Weird, but I fixed it.
Dec 2 '09 #3

P: 1
THX, HaLo2FrEeEk
you gave me directions and ideas ;)

huh, i had SAME SAME problem NOW (i have menustrip, toolstrip and statusstrip)

so here is how i fixed it
i have created new project, and add same controls (menustrip, toolstrip and statusstrip) and added same items (statuslabels, buttons.......) just one of each, so i can see their core in designer !!!!!!!
and just compare old and new project code and add in you project code that is missing (Search fo statusstrip1.....)....
this is Some of code you need to look for !!!

first under private void InitializeComponent()

this.statusStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();

This lines is for adding your items, must use SAME NAMES !!! (need to add addRange for Menustrip & toolstrip also...)
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.toolStripStatusLabel2,
this.toolStripProgressBar1});

//
// Form1
//
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();

need to do same for any Strip controle.....

best regards
SxOne from Serbia
Jan 18 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.