none
怎么使用RadioButton RRS feed

  • 问题

  • 本人是初学者,最近想编一个解一元二次不等式的程序,需要用RadioButton,但是代码不会,如何知道用户究竟选择了哪一个?

    请求高人指点,本人不胜感谢。另外,如何使用命令按钮打开浏览文件夹的窗口。

    2013年6月22日 0:50

答案

  • 如果是WinForm,那么RadioButton(无线电按钮)每次只能选一个。因此你就逐个判断:

    if(Radiobutton1.Checked)
    {
       ……
    }
    else if(Radiobutton2.Checked)
    {
       ……
    }

    If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer

    Help by clicking:
    Click here to donate your rice to the poor
    Click to Donate
    Click to feed Dogs & Cats


    Found any spamming-senders? Please report at: Spam Report

    2013年6月22日 3:03
    版主
  • 你这个一元二次不等式....和RadioButton有什么关系哈?

    如果少的话,可以像楼下说的,

    if(Radiobutton1.Checked) { …… } else if(Radiobutton2.Checked) { …… }

    如果多的话,可以用一个GroupBox容器去装,然后再代码中去类型强制转换Control为Radiobutton,

    判断Checked属性为true就是选择的了...

    2013年6月23日 2:12

全部回复

  • 如果是WinForm,那么RadioButton(无线电按钮)每次只能选一个。因此你就逐个判断:

    if(Radiobutton1.Checked)
    {
       ……
    }
    else if(Radiobutton2.Checked)
    {
       ……
    }

    If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer

    Help by clicking:
    Click here to donate your rice to the poor
    Click to Donate
    Click to feed Dogs & Cats


    Found any spamming-senders? Please report at: Spam Report

    2013年6月22日 3:03
    版主
  • @如何使用命令按钮打开浏览文件夹的窗口

    你在窗体上从工具栏拖拽一个FolderBrowserDialog窗口,然后使用其方法:

    if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                {
     
                }


    If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer

    Help by clicking:
    Click here to donate your rice to the poor
    Click to Donate
    Click to feed Dogs & Cats


    Found any spamming-senders? Please report at: Spam Report

    2013年6月22日 3:08
    版主
  • 你这个一元二次不等式....和RadioButton有什么关系哈?

    如果少的话,可以像楼下说的,

    if(Radiobutton1.Checked) { …… } else if(Radiobutton2.Checked) { …… }

    如果多的话,可以用一个GroupBox容器去装,然后再代码中去类型强制转换Control为Radiobutton,

    判断Checked属性为true就是选择的了...

    2013年6月23日 2:12