相关疑难解决方法(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万
查看次数

如何在组合框中获取已选中的单选按钮?

我在组合框中有很多单选按钮.通常我会单独检查每个单选按钮If radiobutton1.Checked = True Then.

但我想也许有一种聪明的方法来检查在一个组框中检查哪个单选按钮.任何的想法?

.net vb.net visual-studio-2010 radio-button winforms

17
推荐指数
3
解决办法
8万
查看次数

标签 统计

.net ×2

radio-button ×2

winforms ×2

c# ×1

vb.net ×1

visual-studio-2010 ×1