相关疑难解决方法(0)

检查组中的哪个单选按钮?

使用WinForms; 有没有更好的方法来找到一个组的已检查RadioButton?在我看来,下面的代码不应该是必要的.当你检查一个不同的RadioButton然后它知道哪一个取消选中...所以它应该知道哪个被检查.如何在不执行大量if语句(或切换)的情况下提取该信息.

     RadioButton rb = null;

     if (m_RadioButton1.Checked == true)
     {
        rb = m_RadioButton1;
     }
     else if (m_RadioButton2.Checked == true)
     {
        rb = m_RadioButton2;
     }
     else if (m_RadioButton3.Checked == true)
     {
        rb = m_RadioButton3;
     }
Run Code Online (Sandbox Code Playgroud)

.net c# radio-button winforms

116
推荐指数
5
解决办法
29万
查看次数

标签 统计

.net ×1

c# ×1

radio-button ×1

winforms ×1