无法查看表单 - 设计器错误

时间:2017-02-21 21:25:33

标签: c#

我在设计器代码中收到错误"设计人员无法在第163行处理代码,请参阅任务列表了解详细信息。方法中的代码' InitializeComponent'由设计者生成,不应手动修改。请删除所有更改,然后再次尝试打开设计器。"

任务列表显示它"无法找到此错误的关联帮助主题"

这是第163行

this.textBox_Command.TabIndex = 15;

这是整个设计师档案。我花了好几个小时试图逐行评论,但是当我这样做时,它只是抱怨前一行。

*****设计师档案*****

namespace Print
{
    partial class Form_Print
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.button_Print = new System.Windows.Forms.Button();
            this.comboBox_Bartender_File = new System.Windows.Forms.ComboBox();
            this.label1 = new System.Windows.Forms.Label();
            this.button_flush_cache = new System.Windows.Forms.Button();
            this.checkBox_Show_Bartender = new System.Windows.Forms.CheckBox();
            this.checkBoxPause = new System.Windows.Forms.CheckBox();
            this.checkBox_FlucheCache = new System.Windows.Forms.CheckBox();
            this.textBox_Log = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.panel1 = new System.Windows.Forms.Panel();
            this.textBox_Command = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.button_Check_Sensor = new System.Windows.Forms.Button();
            this.rtxtRecv = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.textBox_IP_Address = new System.Windows.Forms.TextBox();
            this.checkBox_Using_Sato = new System.Windows.Forms.CheckBox();
            this.label3 = new System.Windows.Forms.Label();
            this.panel1.SuspendLayout();
            this.SuspendLayout();
            // 
            // button_Print
            // 
            this.button_Print.Location = new System.Drawing.Point(12, 121);
            this.button_Print.Name = "button_Print";
            this.button_Print.Size = new System.Drawing.Size(282, 113);
            this.button_Print.TabIndex = 0;
            this.button_Print.Text = "Print";
            this.button_Print.UseVisualStyleBackColor = true;
            this.button_Print.Click += new System.EventHandler(this.Print_Click);
            // 
            // comboBox_Bartender_File
            // 
            this.comboBox_Bartender_File.DropDownWidth = 243;
            this.comboBox_Bartender_File.FormattingEnabled = true;
            this.comboBox_Bartender_File.Items.AddRange(new object[] {
            "c:\\PrintingApplication\\BartenderFiles\\16353-002a.btw,SATO CL4NX 609dpi",
            "c:\\PrintingApplication\\BartenderFiles\\16353-002a.btw,SATO CL4NX 609dpi"});
            this.comboBox_Bartender_File.Location = new System.Drawing.Point(91, 32);
            this.comboBox_Bartender_File.Name = "comboBox_Bartender_File";
            this.comboBox_Bartender_File.Size = new System.Drawing.Size(191, 21);
            this.comboBox_Bartender_File.TabIndex = 3;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(9, 40);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(76, 13);
            this.label1.TabIndex = 2;
            this.label1.Text = "BarTender File";
            // 
            // button_flush_cache
            // 
            this.button_flush_cache.Location = new System.Drawing.Point(727, 40);
            this.button_flush_cache.Name = "button_flush_cache";
            this.button_flush_cache.Size = new System.Drawing.Size(150, 51);
            this.button_flush_cache.TabIndex = 5;
            this.button_flush_cache.Text = "Flush Cache";
            this.button_flush_cache.UseVisualStyleBackColor = true;
            this.button_flush_cache.Click += new System.EventHandler(this.button_flush_cache_Click);
            // 
            // checkBox_Show_Bartender
            // 
            this.checkBox_Show_Bartender.AutoSize = true;
            this.checkBox_Show_Bartender.Location = new System.Drawing.Point(12, 12);
            this.checkBox_Show_Bartender.Name = "checkBox_Show_Bartender";
            this.checkBox_Show_Bartender.Size = new System.Drawing.Size(195, 17);
            this.checkBox_Show_Bartender.TabIndex = 6;
            this.checkBox_Show_Bartender.Text = "Show BarTender During Processing";
            this.checkBox_Show_Bartender.UseVisualStyleBackColor = true;
            // 
            // checkBoxPause
            // 
            this.checkBoxPause.AutoSize = true;
            this.checkBoxPause.Location = new System.Drawing.Point(305, 12);
            this.checkBoxPause.Name = "checkBoxPause";
            this.checkBoxPause.Size = new System.Drawing.Size(165, 17);
            this.checkBoxPause.TabIndex = 10;
            this.checkBoxPause.Text = "Pause Printer after each label";
            this.checkBoxPause.UseVisualStyleBackColor = true;
            // 
            // checkBox_FlucheCache
            // 
            this.checkBox_FlucheCache.AutoSize = true;
            this.checkBox_FlucheCache.Location = new System.Drawing.Point(498, 12);
            this.checkBox_FlucheCache.Name = "checkBox_FlucheCache";
            this.checkBox_FlucheCache.Size = new System.Drawing.Size(413, 17);
            this.checkBox_FlucheCache.TabIndex = 6;
            this.checkBox_FlucheCache.Text = "Flush Cache between printouts of bartender files if the bartender filename change" +
    "s\r\n";
            this.checkBox_FlucheCache.UseVisualStyleBackColor = true;
            // 
            // textBox_Log
            // 
            this.textBox_Log.Location = new System.Drawing.Point(15, 322);
            this.textBox_Log.Multiline = true;
            this.textBox_Log.Name = "textBox_Log";
            this.textBox_Log.Size = new System.Drawing.Size(872, 145);
            this.textBox_Log.TabIndex = 11;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(14, 306);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(71, 13);
            this.label2.TabIndex = 12;
            this.label2.Text = "Message Log";
            // 
            // panel1
            // 
            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.panel1.Controls.Add(this.textBox_Command);
            this.panel1.Controls.Add(this.label6);
            this.panel1.Controls.Add(this.button_Check_Sensor);
            this.panel1.Controls.Add(this.rtxtRecv);
            this.panel1.Controls.Add(this.label5);
            this.panel1.Controls.Add(this.label4);
            this.panel1.Controls.Add(this.textBox_IP_Address);
            this.panel1.Controls.Add(this.checkBox_Using_Sato);
            this.panel1.Location = new System.Drawing.Point(305, 121);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(582, 198);
            this.panel1.TabIndex = 13;
            // 
            // textBox_Command
            // 
            this.textBox_Command.Location = new System.Drawing.Point(68, 92);
            this.textBox_Command.Name = "textBox_Command";
            this.textBox_Command.Size = new System.Drawing.Size(100, 20);
            this.textBox_Command.TabIndex = 15;
            this.textBox_Command.Text = "PD";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(7, 100);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(54, 13);
            this.label6.TabIndex = 14;
            this.label6.Text = "Command";
            // 
            // button_Check_Sensor
            // 
            this.button_Check_Sensor.Location = new System.Drawing.Point(375, 20);
            this.button_Check_Sensor.Name = "button_Check_Sensor";
            this.button_Check_Sensor.Size = new System.Drawing.Size(75, 68);
            this.button_Check_Sensor.TabIndex = 13;
            this.button_Check_Sensor.Text = "Check Sensor";
            this.button_Check_Sensor.UseVisualStyleBackColor = true;
            this.button_Check_Sensor.Click += new System.EventHandler(this.button_Check_Sensor_Click);
            // 
            // rtxtRecv
            // 
            this.rtxtRecv.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
            this.rtxtRecv.Location = new System.Drawing.Point(86, 131);
            this.rtxtRecv.Multiline = true;
            this.rtxtRecv.Name = "rtxtRecv";
            this.rtxtRecv.Size = new System.Drawing.Size(482, 61);
            this.rtxtRecv.TabIndex = 12;
            this.rtxtRecv.Text = "Unknown";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(7, 134);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(73, 13);
            this.label5.TabIndex = 11;
            this.label5.Text = "Sensor Status";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(4, 4);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(91, 13);
            this.label4.TabIndex = 1;
            this.label4.Text = "Printer IP Address";
            // 
            // textBox_IP_Address
            // 
            this.textBox_IP_Address.Location = new System.Drawing.Point(7, 20);
            this.textBox_IP_Address.Name = "textBox_IP_Address";
            this.textBox_IP_Address.Size = new System.Drawing.Size(307, 20);
            this.textBox_IP_Address.TabIndex = 0;
            this.textBox_IP_Address.Text = "10.162.21.11";
            // 
            // checkBox_Using_Sato
            // 
            this.checkBox_Using_Sato.AutoSize = true;
            this.checkBox_Using_Sato.Location = new System.Drawing.Point(7, 62);
            this.checkBox_Using_Sato.Name = "checkBox_Using_Sato";
            this.checkBox_Using_Sato.Size = new System.Drawing.Size(118, 17);
            this.checkBox_Using_Sato.TabIndex = 10;
            this.checkBox_Using_Sato.Text = "Using SATO Printer";
            this.checkBox_Using_Sato.UseVisualStyleBackColor = true;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(302, 100);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(118, 13);
            this.label3.TabIndex = 14;
            this.label3.Text = "SATO Specific Settings";
            // 
            // Form_Print
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(889, 474);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.textBox_Log);
            this.Controls.Add(this.checkBoxPause);
            this.Controls.Add(this.checkBox_FlucheCache);
            this.Controls.Add(this.checkBox_Show_Bartender);
            this.Controls.Add(this.button_flush_cache);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.comboBox_Bartender_File);
            this.Controls.Add(this.button_Print);
            this.Name = "Form_Print";
            this.Text = "*** SATO Printer Application FPA ***";
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button button_Print;
        private System.Windows.Forms.ComboBox comboBox_Bartender_File;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button_flush_cache;
        private System.Windows.Forms.CheckBox checkBox_Show_Bartender;
        private System.Windows.Forms.CheckBox checkBoxPause;
        private System.Windows.Forms.CheckBox checkBox_FlucheCache;
        private System.Windows.Forms.TextBox textBox_Log;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.TextBox textBox_IP_Address;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Button button_Check_Sensor;
        private System.Windows.Forms.TextBox rtxtRecv;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.CheckBox checkBox_Using_Sato;
        private System.Windows.Forms.TextBox textBox_Command;
        private System.Windows.Forms.Label label6;
    }
}

调用堆栈

此错误的实例(1)

Print Form1.Designer.cs Line:163 Column:1   Hide Call Stack 

at Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.ParseXml(String xmlStream, CodeStatementCollection statementCollection, String fileName, String methodName)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnMethodPopulateStatements(Object sender, EventArgs e)
at System.CodeDom.CodeMemberMethod.get_Statements()
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)  

1 个答案:

答案 0 :(得分:1)

使用您发布的Designer代码,我能够查看表单。我打赌旧文件,或VS只是得到&#34;困惑&#34;。我不能说比这更好,这种事情在我之前发生过。

第一步是Build - &gt;清洁解决方案然后关闭并重新打开解决方案。

如果这不起作用,请确保执行上面提到的Dave SWill,并手动删除所有/ bin和/ obj文件夹。然后关闭并重新打开。

如果这些都不起作用,您可以通过打开项目(无需打开表单)进行更多调试以查看问题的确切位置,然后打开第二个空白Visual Studio窗口(无项目),然后使用&#34;附加&#34;功能选择第一个Visual Studio窗口(&#34; devenv.exe&#34;在点击&#34后打开的列表中;&attach&#34;)。接下来,打开表单,查看错误导致的位置。

我知道这不是一个完整的解决方案,但希望它有助于进入下一步的错误。祝你好运,因为我知道用工具玩弄是痛苦而且没有效果。