Hi !
I have a Windows form made in vs 2008, Framework 3.5. To my windows form i have added a menustrip and a statusstrip. Its all worked fine. I have added som png images and uses System.Resources to handle the images. It all started when i tried to change a image for a commandbutton. I deleted the image from Resources folder and the all the items in the MenuStrip and the StatusStrip where gone.
In the designer.cs for my form the items are still there but the controls don´t find them. Here is the designers code and you can se the items. Now I have removed all the images from the Resources folder.
How do i fix this. I don´t want to redo all the work. It´s happend before, and then I recreated all the controls, but I don´t want to do tha again. Som whats wrong and why does this happend.
Regards!
/Tyronne
- namespace HUGO
- {
- partial class frmMain
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- #region Windows Form Designer generated code
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.panel1 = new System.Windows.Forms.Panel();
- this.pictureBox2 = new System.Windows.Forms.PictureBox();
- this.lblDate = new System.Windows.Forms.Label();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.lblTime = new System.Windows.Forms.Label();
- this.lbltnr = new System.Windows.Forms.Label();
- this.cmdEnemy = new System.Windows.Forms.Button();
- this.cmdTime = new System.Windows.Forms.Button();
- this.cmdInOut = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.menuStrip1 = new System.Windows.Forms.MenuStrip();
- this.arkivToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.anslutTillDatabasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.bytAnvndareToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
- this.avslutaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.instllningarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.funktionerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.visaInUtToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.visaTidslinjalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.visaMotstndarenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.statusStrip1 = new System.Windows.Forms.StatusStrip();
- this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.bytAnvndareToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.timerTnr = new System.Windows.Forms.Timer(this.components);
- this.timerClock = new System.Windows.Forms.Timer(this.components);
- this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
- this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
- this.panel1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.contextMenuStrip1.SuspendLayout();
- this.SuspendLayout();
- //
- // panel1
- //
- this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.panel1.Controls.Add(this.pictureBox2);
- this.panel1.Controls.Add(this.lblDate);
- this.panel1.Controls.Add(this.pictureBox1);
- this.panel1.Controls.Add(this.lblTime);
- this.panel1.Controls.Add(this.lbltnr);
- this.panel1.Controls.Add(this.cmdEnemy);
- this.panel1.Controls.Add(this.cmdTime);
- this.panel1.Controls.Add(this.cmdInOut);
- this.panel1.Controls.Add(this.label1);
- this.panel1.Location = new System.Drawing.Point(0, 24);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(134, 739);
- this.panel1.TabIndex = 1;
- //
- // pictureBox2
- //
- this.pictureBox2.Location = new System.Drawing.Point(7, 43);
- this.pictureBox2.Name = "pictureBox2";
- this.pictureBox2.Size = new System.Drawing.Size(39, 31);
- this.pictureBox2.TabIndex = 10;
- this.pictureBox2.TabStop = false;
- //
- // lblDate
- //
- this.lblDate.AutoSize = true;
- this.lblDate.Location = new System.Drawing.Point(48, 47);
- this.lblDate.Name = "lblDate";
- this.lblDate.Size = new System.Drawing.Size(22, 13);
- this.lblDate.TabIndex = 9;
- this.lblDate.Text = "Tid";
- this.lblDate.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // pictureBox1
- //
- this.pictureBox1.Location = new System.Drawing.Point(7, 3);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(39, 34);
- this.pictureBox1.TabIndex = 7;
- this.pictureBox1.TabStop = false;
- //
- // lblTime
- //
- this.lblTime.AutoSize = true;
- this.lblTime.Location = new System.Drawing.Point(48, 14);
- this.lblTime.Name = "lblTime";
- this.lblTime.Size = new System.Drawing.Size(22, 13);
- this.lblTime.TabIndex = 6;
- this.lblTime.Text = "Tid";
- this.lblTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // lbltnr
- //
- this.lbltnr.AutoSize = true;
- this.lbltnr.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbltnr.ForeColor = System.Drawing.Color.Blue;
- this.lbltnr.Location = new System.Drawing.Point(48, 59);
- this.lbltnr.Name = "lbltnr";
- this.lbltnr.Size = new System.Drawing.Size(21, 15);
- this.lbltnr.TabIndex = 5;
- this.lbltnr.Text = "tnr";
- this.lbltnr.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // cmdEnemy
- //
- this.cmdEnemy.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.cmdEnemy.Location = new System.Drawing.Point(4, 235);
- this.cmdEnemy.Name = "cmdEnemy";
- this.cmdEnemy.Size = new System.Drawing.Size(124, 39);
- this.cmdEnemy.TabIndex = 4;
- this.cmdEnemy.Text = "Motstndaren";
- this.cmdEnemy.UseVisualStyleBackColor = true;
- //
- // cmdTime
- //
- this.cmdTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.cmdTime.Location = new System.Drawing.Point(3, 174);
- this.cmdTime.Name = "cmdTime";
- this.cmdTime.Size = new System.Drawing.Size(124, 55);
- this.cmdTime.TabIndex = 3;
- this.cmdTime.Text = "Tidslinjal";
- this.cmdTime.UseVisualStyleBackColor = true;
- //
- // cmdInOut
- //
- this.cmdInOut.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.cmdInOut.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
- this.cmdInOut.Location = new System.Drawing.Point(4, 113);
- this.cmdInOut.Name = "cmdInOut";
- this.cmdInOut.Size = new System.Drawing.Size(124, 55);
- this.cmdInOut.TabIndex = 2;
- this.cmdInOut.Text = "IN / UT";
- this.cmdInOut.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
- this.cmdInOut.UseVisualStyleBackColor = true;
- //
- // label1
- //
- this.label1.BackColor = System.Drawing.Color.Gray;
- this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label1.ForeColor = System.Drawing.Color.White;
- this.label1.Location = new System.Drawing.Point(4, 92);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(124, 18);
- this.label1.TabIndex = 1;
- this.label1.Text = "FUNKTIONER";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // menuStrip1
- //
- this.menuStrip1.Location = new System.Drawing.Point(0, 0);
- this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(965, 24);
- this.menuStrip1.TabIndex = 2;
- this.menuStrip1.Text = "menuStrip1";
- //
- // arkivToolStripMenuItem
- //
- this.arkivToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.anslutTillDatabasToolStripMenuItem,
- this.bytAnvndareToolStripMenuItem,
- this.toolStripMenuItem1,
- this.avslutaToolStripMenuItem,
- this.instllningarToolStripMenuItem});
- this.arkivToolStripMenuItem.Name = "arkivToolStripMenuItem";
- this.arkivToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
- this.arkivToolStripMenuItem.Text = "Arkiv";
- //
- // anslutTillDatabasToolStripMenuItem
- //
- this.anslutTillDatabasToolStripMenuItem.Name = "anslutTillDatabasToolStripMenuItem";
- this.anslutTillDatabasToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
- this.anslutTillDatabasToolStripMenuItem.Text = "Anslut till databas";
- this.anslutTillDatabasToolStripMenuItem.Click += new System.EventHandler(this.anslutTillDatabasToolStripMenuItem_Click);
- //
- // bytAnvndareToolStripMenuItem
- //
- this.bytAnvndareToolStripMenuItem.Name = "bytAnvndareToolStripMenuItem";
- this.bytAnvndareToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
- this.bytAnvndareToolStripMenuItem.Text = "Byt anvndare";
- this.bytAnvndareToolStripMenuItem.Click += new System.EventHandler(this.bytAnvndareToolStripMenuItem_Click);
- //
- // toolStripMenuItem1
- //
- this.toolStripMenuItem1.Name = "toolStripMenuItem1";
- this.toolStripMenuItem1.Size = new System.Drawing.Size(167, 6);
- //
- // avslutaToolStripMenuItem
- //
- this.avslutaToolStripMenuItem.Name = "avslutaToolStripMenuItem";
- this.avslutaToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
- this.avslutaToolStripMenuItem.Text = "Anvndare";
- this.avslutaToolStripMenuItem.Click += new System.EventHandler(this.avslutaToolStripMenuItem_Click_1);
- //
- // instllningarToolStripMenuItem
- //
- this.instllningarToolStripMenuItem.Name = "instllningarToolStripMenuItem";
- this.instllningarToolStripMenuItem.Size = new System.Drawing.Size(170, 22);
- this.instllningarToolStripMenuItem.Text = "Instllningar";
- //
- // funktionerToolStripMenuItem
- //
- this.funktionerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.visaInUtToolStripMenuItem,
- this.visaTidslinjalToolStripMenuItem,
- this.visaMotstndarenToolStripMenuItem});
- this.funktionerToolStripMenuItem.Name = "funktionerToolStripMenuItem";
- this.funktionerToolStripMenuItem.Size = new System.Drawing.Size(70, 20);
- this.funktionerToolStripMenuItem.Text = "Funktioner";
- this.funktionerToolStripMenuItem.Click += new System.EventHandler(this.funktionerToolStripMenuItem_Click);
- //
- // visaInUtToolStripMenuItem
- //
- this.visaInUtToolStripMenuItem.Name = "visaInUtToolStripMenuItem";
- this.visaInUtToolStripMenuItem.Size = new System.Drawing.Size(174, 22);
- this.visaInUtToolStripMenuItem.Text = "Visa In/Ut ";
- this.visaInUtToolStripMenuItem.Click += new System.EventHandler(this.visaInUtToolStripMenuItem_Click);
- //
- // visaTidslinjalToolStripMenuItem
- //
- this.visaTidslinjalToolStripMenuItem.Name = "visaTidslinjalToolStripMenuItem";
- this.visaTidslinjalToolStripMenuItem.Size = new System.Drawing.Size(174, 22);
- this.visaTidslinjalToolStripMenuItem.Text = "Visa Tidslinjal";
- //
- // visaMotstndarenToolStripMenuItem
- //
- this.visaMotstndarenToolStripMenuItem.Name = "visaMotstndarenToolStripMenuItem";
- this.visaMotstndarenToolStripMenuItem.Size = new System.Drawing.Size(174, 22);
- this.visaMotstndarenToolStripMenuItem.Text = "Visa Motstndaren";
- //
- // statusStrip1
- //
- this.statusStrip1.ContextMenuStrip = this.contextMenuStrip1;
- this.statusStrip1.Location = new System.Drawing.Point(0, 741);
- this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Size = new System.Drawing.Size(965, 22);
- this.statusStrip1.TabIndex = 4;
- this.statusStrip1.Text = "statusStrip1";
- //
- // contextMenuStrip1
- //
- this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.bytAnvndareToolStripMenuItem1});
- this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(157, 26);
- //
- // bytAnvndareToolStripMenuItem1
- //
- this.bytAnvndareToolStripMenuItem1.Name = "bytAnvndareToolStripMenuItem1";
- this.bytAnvndareToolStripMenuItem1.Size = new System.Drawing.Size(156, 22);
- this.bytAnvndareToolStripMenuItem1.Text = "Byt anvndare";
- this.bytAnvndareToolStripMenuItem1.Click += new System.EventHandler(this.bytAnvndareToolStripMenuItem1_Click);
- //
- // timerTnr
- //
- this.timerTnr.Tick += new System.EventHandler(this.timer1_Tick);
- //
- // timerClock
- //
- this.timerClock.Interval = 1000;
- this.timerClock.Tick += new System.EventHandler(this.timerClock_Tick);
- //
- // toolStripStatusLabel1
- //
- this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
- this.toolStripStatusLabel1.Size = new System.Drawing.Size(67, 17);
- this.toolStripStatusLabel1.Text = "Databas:";
- //
- // toolStripStatusLabel2
- //
- this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
- this.toolStripStatusLabel2.Size = new System.Drawing.Size(72, 17);
- this.toolStripStatusLabel2.Text = "Inloggad: ";
- //
- // frmMain
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(965, 763);
- this.Controls.Add(this.statusStrip1);
- this.Controls.Add(this.panel1);
- this.Controls.Add(this.menuStrip1);
- this.IsMdiContainer = true;
- this.MainMenuStrip = this.menuStrip1;
- this.Name = "frmMain";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "HUGO";
- this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing);
- this.panel1.ResumeLayout(false);
- this.panel1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.contextMenuStrip1.ResumeLayout(false);
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- #endregion
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.MenuStrip menuStrip1;
- private System.Windows.Forms.Button cmdEnemy;
- private System.Windows.Forms.Button cmdTime;
- private System.Windows.Forms.Button cmdInOut;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.StatusStrip statusStrip1;
- private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
- private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
- private System.Windows.Forms.ToolStripMenuItem arkivToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem anslutTillDatabasToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem bytAnvndareToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
- private System.Windows.Forms.ToolStripMenuItem avslutaToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem funktionerToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem visaInUtToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem visaTidslinjalToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem visaMotstndarenToolStripMenuItem;
- private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
- private System.Windows.Forms.ToolStripMenuItem bytAnvndareToolStripMenuItem1;
- private System.Windows.Forms.ToolStripMenuItem instllningarToolStripMenuItem;
- private System.Windows.Forms.Timer timerTnr;
- private System.Windows.Forms.Timer timerClock;
- private System.Windows.Forms.PictureBox pictureBox1;
- private System.Windows.Forms.Label lblTime;
- private System.Windows.Forms.Label lbltnr;
- private System.Windows.Forms.Label lblDate;
- private System.Windows.Forms.PictureBox pictureBox2;
- }
- }
Loading
Nenad RadovanovicPosted Jan 18, 2010, 1:52 AM
but i have figure it out.......
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 code 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