2017-02-03 20 views
-1

私は非常に新しいコーディングですが、興味があり、コミュニティカレッジでクラスを受講することに決めました。私は自分の選択した3つの単語のための言語翻訳を作成する基本的な課題を完了しています。私は自分の本をたどりましたが、まだ間違いを受けています。私は下のコードとエラーをコピーして、何か指針を感謝します。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" 

エラー:あなたが取得しているかのエラー

+0

あなたの質問は不完全なようです。 – brugnner

+0

問題を解決するためにコード全体を投稿する必要があります。あなたはいくつかのコードが不足しているようです。 –

+0

7行目のかっこは何ですか? –

答えて

0

あまりにもわからない、あなたの質問の一部が今空白です。

私は "private void HelloButton"の配置にいくつかの問題がありますが、それはクラス自体の外にあるようです。

あなたは正しい、私が言及した部分の上に }}

ある2つの行を持って、それはあなただけのプライベート無効HelloButton続い1}でなければなりません。そして、最後にあなたは1つが欠けている}、さらには閉じる}。

ここはあなたが望むものに近いものです。私はあなたのコードのすべてを持っていないので、最後の部分だけをきれいにしました。あなたは{と}のマッチングについてもっと注意する必要があります。もう一つは、#endregionの配置です。これは、それが参照する自動コードに追いつくべきです。

// 
     // 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"; 
    } 
} 

}

+0

トレイルありがとう! –

関連する問題