menuStrip and toolStrip acting oddly after resource deletion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • HaLo2FrEeEk
    Contributor
    • Feb 2007
    • 404

    #1

    menuStrip and toolStrip acting oddly after resource deletion

    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!
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    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

    Comment

    • HaLo2FrEeEk
      Contributor
      • Feb 2007
      • 404

      #3
      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.

      Comment

      • SxOne
        New Member
        • Jan 2010
        • 1

        #4
        lost items from menustrip, toolstrip, statusstrip, dont see them in designer

        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 InitializeCompo nent()

        this.statusStri p1.SuspendLayou t();
        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.statusStri p1.Items.AddRan ge(new System.Windows. Forms.ToolStrip Item[] {
        this.toolStripS tatusLabel1,
        this.toolStripS tatusLabel2,
        this.toolStripP rogressBar1});

        //
        // Form1
        //
        this.statusStri p1.ResumeLayout (false);
        this.statusStri p1.PerformLayou t();
        this.toolStrip1 .ResumeLayout(f alse);
        this.toolStrip1 .PerformLayout( );
        this.menuStrip1 .ResumeLayout(f alse);
        this.menuStrip1 .PerformLayout( );

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

        best regards
        SxOne from Serbia

        Comment

        Working...