|
 |
|
C# WinApp ช่วยด้วยครับ อยู่เฉยๆ ผมก็งง กับ checkBox ครับ |
|
 |
|
|
 |
 |
|
ตามนี้ครับ
https://youtu.be/StdzvVtizQg
โค้ดครับ
Code (C#)
string chk = "";
private void button1_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(chk))
{
richTextBox1.Text = chk;
}
else
{
richTextBox1.Text = "don't have checkBox ";
}
}
void CheckedChanged()
{
if (checkBox1.Checked && !chk.Contains("checkBox1,"))
{
MessageBox.Show("checkBox1,");
chk += "checkBox1,";
}
else
{
chk= chk.Replace("checkBox1,", "");
}
if (checkBox2.Checked && !chk.Contains("checkBox2,"))
{
MessageBox.Show("checkBox2,");
chk += "checkBox2,";
}
else
{
chk= chk.Replace("checkBox2,", "");
}
if (checkBox3.Checked && !chk.Contains("checkBox3,"))
{
MessageBox.Show("checkBox3,");
chk += "checkBox3,";
}
else
{
chk= chk.Replace("checkBox3,", "");
}
if (checkBox4.Checked && !chk.Contains("checkBox4,"))
{
MessageBox.Show("checkBox4,");
chk += "checkBox4,";
}
else
{
chk= chk.Replace("checkBox4,", "");
}
}
private void checkBox1_Click(object sender, EventArgs e)
{
CheckedChanged();
}
เพียงแค่อยากเช็คว่า checkBox ไหนทำงานอยู่ แค่นั้นครับ
หากไม่มีตัวไหนทำงานก็ให้แจ้งว่า ไม่มี checkBox ทำงาน
Tag : .NET, Win (Windows App), C#

|
|
 |
 |
 |
 |
Date :
2022-05-04 09:38:44 |
By :
lamaka.tor |
View :
541 |
Reply :
0 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 05
|