กรุณาเลือก แสดงผลรูปแบบโทรศัพท์มือถือ | แสดงผลรูแบบคอมพิวเตอร์

Dekcom Board • The Ultimate Knowledge Share

 ลืมรหัสผ่าน
 ลงทะเบียน
ค้นหา
ดู: 657|ตอบ: 0

ตัวอย่างการใช้ RadioButton เพื่อตรวจสอบการเลือก [คัดลอกลิงก์]

Rank: 9Rank: 9Rank: 9

Money
144
จิตพิศัย
39
สมัครสมาชิกเมื่อ
2009-12-20
เครดิต
39
โพสต์
42
webmaster โพสต์เมื่อ 2010-8-5 08:25:54 |แสดงโพสต์ทั้งหมด
  1. private void Form1_Load(object sender, EventArgs e)
  2.         {
  3.             showLabel.Text = "";
  4.         }

  5.         private void clearButton_Click(object sender, EventArgs e)
  6.         {
  7.             showLabel.Text = "";
  8.             mRadioButton.Checked = false;
  9.             fRadioButton.Checked = false;
  10.             singleRadioButton.Checked = false;
  11.             marryRadioButton.Checked = false;
  12.             widowRadioButton.Checked = false;
  13.             marry_cancelRadioButton.Checked = false;
  14.         }

  15.         private void endButton_Click(object sender, EventArgs e)
  16.         {
  17.             Application.Exit();
  18.         }

  19.         private void button1_Click(object sender, EventArgs e)
  20.         {
  21.             string strGender = "", strStatus = "";

  22.             if (mRadioButton.Checked == true)
  23.             {
  24.                 strGender = mRadioButton.Text;
  25.             }
  26.             if (fRadioButton.Checked == true)
  27.             {
  28.                 strGender = fRadioButton.Text;
  29.             }

  30.             if (singleRadioButton.Checked == true)
  31.             {
  32.                 strStatus = singleRadioButton.Text;
  33.             }
  34.             else if (marryRadioButton.Checked == true)
  35.             {
  36.                 strStatus = marryRadioButton.Text;
  37.             }
  38.             else if (widowRadioButton.Checked == true)
  39.             {
  40.                 strStatus = widowRadioButton.Text;
  41.             }
  42.             else if (marry_cancelRadioButton.Checked == true)
  43.             {
  44.                 strStatus = marry_cancelRadioButton.Text;
  45.             }

  46.             showLabel.Text = "คุณเลือกเพศ " + strGender + " และสถานะ " + strStatus;
  47.         }
คัดลอกไปที่คลิปบอร์ด
ผลรัน
2010-08-05_081846.jpg
2010-08-05_081855.jpg
2010-08-05_081903.jpg

Lab5_5.rar

37.37 KB, จำนวนดาวน์โหลด: 50


รับทำเว็บ PHP+MySQL
คุณต้องเข้าสู่ระบบก่อนจึงจะสามารถตอบกลับ เข้าสู่ระบบ | ลงทะเบียน

รูปแบบข้อความล้วน|โทรศัพท์มือถือ|เด็กคอมพ์ชิตี้

GMT+7, 2012-5-21 05:14 , Processed in 0.029865 second(s), 16 queries , Gzip On.

Powered by Discuz! X2

© 2001-2011 Comsenz Inc. Page Ranking Tool

ขึ้นไปด้านบน