Results 1 to 4 of 4

Thread: ช่วยดูโค้ดตัวนี้ทีครับ C#

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    11


    Code:
    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
            {
                if (textBox1.Text == "")
                {
                    MessageBox.Show("ท่านยังใส่ข้อมูลไม่ครบ");
                    e.Cancel = true;
                }
                else
                {
                    e.Cancel = false;
                }
            }
    ผมพิมพ์ตามหนังสือทุกอย่างพอลองคอมไพล์ ดู มันไม่หืไม่อื อะไรเลย เมล์ไปถามคนเขียนหนังสือเค้าว่า "ปัญหาน่าจะเกิดจากคุณสร้าง Event Handler ผิดวิธีครับ คือคุณไม่ได้เชื่อมโยงเมธอด Form1_FormClosing กับฟอร์มครับ " ผมพยายามลองสร้าง สร้างอย่่างไงก็ไม่ได้สะที รบกวนช่วยอธิบายด้วยนะครับ

  2. #2
    Senior Member
    Join Date
    Sep 2007
    Location
    Laos
    Posts
    192


    1 out of 1 members found this post helpful.
    Please make sure that you add the event from here



    Hope this help

  3. #3
    Senior Member
    Join Date
    Jul 2004
    Location
    Thailand
    Posts
    211


    ตามท่าน snapter เลย การเขียนโปรแกรม ลากวาง (RAD) พวก Event มันต้องให้ ide สร้าง
    ให้ เขียนเองหมด มักไม่เวิร์ค คือ เค้าพยายามอำนวยความสะดวกให้แบบสุดๆเลย พิมพ์ให้น้อยที่สุด
    จะได้เอาเวลาไปคิดพวก logic อื่นๆ เล่นบ่อยๆ จะเข้าใจจุดนี้เอง

  4. #4
    Junior Member jacknaclup's Avatar
    Join Date
    Mar 2010
    Location
    BKK
    Posts
    5


    ลองตั้งชือ Form ใหม่ตามคำสั่งยังอ่ะครับไปดูที่ Properties แล้วลองตั้งชื่อใหม่ตามที่คุณเขียนโค็ดลงไปดูครับ

    (ที่จริงน่าจะเอาคำที่บอกว่ามัน Error บรรทัดไหนว่ายังไงมาน่ะจะได้ดูง่ายกว่า)

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •