我對編碼非常陌生,但我很感興趣,所以決定在我的社區學院上課。我正在完成一項基本任務,爲我選擇的三個單詞創建一個語言翻譯器。我跟着我的書,但仍然收到錯誤。我在下面複製了我的代碼和錯誤,並且非常感謝任何指導。C#中的錯誤,Visual Studio
-- using System;
namespace Language_Translator_Latin
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
)
{
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.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(21, 112);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(85, 21);
this.button1.TabIndex = 0;
this.button1.Text = "Hello";
this.button1.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Location = new System.Drawing.Point(149, 112);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(85, 21);
this.button2.TabIndex = 1;
this.button2.Text = "Happy";
this.button2.UseVisualStyleBackColor = true;
//
// button3
//
this.button3.Location = new System.Drawing.Point(288, 112);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(85, 21);
this.button3.TabIndex = 2;
this.button3.Text = "Good night";
this.button3.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(81, 41);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(201, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Select a word and I will convert it to Latin";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(198, 76);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 4;
this.label2.Text = "label2";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(431, 164);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}
private void HelloButton_Click(object sender, EventArgs e)
{
translationLabel.Text = "Salve";
}
private void HappyButton_Click(object sender, EventArgs e)
{
translationLabel.Text = "Laeta";
}
private void GoodnightButton_Click(object sender, EventArgs e)
{
translationLabel.Text = "Bonum nox"
錯誤:
你的問題似乎是不完整的。 – brugnner
您需要發佈整個代碼,以便我們糾正問題。看來你錯過了一些代碼。 –
第7行的括號是什麼? –