How do I group Windows Form radio buttons?

前端 未结 9 1677
鱼传尺愫
鱼传尺愫 2020-11-27 11:33

How can I group the radio buttons in Windows Form application (a lot like ASP.NET\'s radiobuttonlist!)?

So I can switch between each case chosen from the options.

9条回答
  •  青春惊慌失措
    2020-11-27 11:54

    If you cannot put them into one container, then you have to write code to change checked state of each RadioButton:

    private void rbDataSourceFile_CheckedChanged(object sender, EventArgs e)
    {
        rbDataSourceNet.Checked = !rbDataSourceFile.Checked;
    }
    
    private void rbDataSourceNet_CheckedChanged(object sender, EventArgs e)
    {
      rbDataSourceFile.Checked = !rbDataSourceNet.Checked;
    }
    

提交回复
热议问题