2016-04-30 81 views
-2

首先對不起我的英語不好,錯誤在Windows窗體

我的老師給了我一些家庭作業做,他告訴我做一個程序「Windows窗體」命令從家裏的水果,但我代碼中有這兩個錯誤。這兩個錯誤來自三行斜線。我希望有人能幫助我。謝謝。

 this.tex_shbanane.Location = new System.Drawing.Point(316, 242); 
     this.tex_shbanane.Name = "tex_shbanane"; 
     this.tex_shbanane.ReadOnly = true; 
     this.tex_shbanane.Size = new System.Drawing.Size(70, 20); 
     this.tex_shbanane.TabIndex = 22; 
/// this.tex_shbanane.TextChanged += new System.EventHandler(this.tex_shbanane_TextChanged); 
     // 
     // tex_shgjithsej 
     // 
     this.tex_shgjithsej.Location = new System.Drawing.Point(316, 268); 
     this.tex_shgjithsej.Name = "tex_shgjithsej"; 
     this.tex_shgjithsej.ReadOnly = true; 
     this.tex_shgjithsej.Size = new System.Drawing.Size(70, 20); 
     this.tex_shgjithsej.TabIndex = 23; 
     this.tex_shgjithsej.TextChanged += new System.EventHandler(this.tex_shgjithsej_TextChanged); 
     // 
     // tex_shtaksa 
     // 
     this.tex_shtaksa.Location = new System.Drawing.Point(316, 294); 
     this.tex_shtaksa.Name = "tex_shtaksa"; 
     this.tex_shtaksa.ReadOnly = true; 
     this.tex_shtaksa.Size = new System.Drawing.Size(70, 20); 
     this.tex_shtaksa.TabIndex = 24; 
     this.tex_shtaksa.TextChanged += new System.EventHandler(this.tex_shtaksa_TextChanged); 
     // 
     // tex_shtransporti 
     // 
     this.tex_shtransporti.Location = new System.Drawing.Point(316, 318); 
     this.tex_shtransporti.Name = "tex_shtransporti"; 
     this.tex_shtransporti.ReadOnly = true; 
     this.tex_shtransporti.Size = new System.Drawing.Size(70, 20); 
     this.tex_shtransporti.TabIndex = 25; 
    /// this.tex_shtransporti.TextChanged += new System.EventHandler(this.tex_shtransporti_TextChanged); 
+2

..有什麼錯誤? –

+0

哪種類型的錯誤? – Mostafiz

+0

CS1061 \t'Form1'不包含'tex_shtransporti_TextChanged'的定義,並且沒有找到接受'Form1'類型的第一個參數的擴展方法'tex_shtransporti_TextChanged'(您缺少使用指令或程序集引用嗎? – Dren

回答

1

您已經理解了您爲什麼從@ Dour的評論中收到錯誤。

您還沒有定義事件tex_shtransporti_TextChanged

private void tex_shtransporti_TextChanged(object sender, EventArgs e) 
    { 
     // implement your code here. 
    } 

只要注意,你也可以手動生成事件從VS designer.Just按照步驟。

  • 單擊窗體中的TextBox。
  • 打開屬性窗口 (按F4)。
  • 選擇活動頁面。
  • 雙擊TextChanged 屬性行。
+0

非常感謝,它正在工作現在。 – Dren