public void button1_Click(object sender, EventArgs e)
{
string value;
bool isChecked = radioButton1.Checked;
if (isChecked)
{
value = radioButton1.Text;
}
else if (isChecked)
{
value = radioButton2.Text;
}
else if (isChecked)
{
value = radioButton3.Text;
}
else if (isChecked)
{
value = radioButton4.Text;
}
else
{
value = radioButton5.Text;
}
label2.Text = "Installation location:'" + value;
}
如何檢查所有單選按鈕並在標籤或文本框上書寫?只有寫入radioButton1值,我選擇其他按鈕寫入radioButton5值。 在此先感謝!
單選按鈕1的值= d:
單選按鈕2的值= E:
單選按鈕3的值= F:
單選按鈕4的值= G:
單選按鈕5的值= H:
我創建文本編輯器和下載器...C#:如何檢查表格上的所有單選按鈕
目前尚不清楚你想要達到的目標。例如,你爲什麼反覆評估isChecked?這是真的還是假的,並沒有改變。 –