VB.NET default radio button selected inside a group box

前端 未结 8 799
醉话见心
醉话见心 2021-01-16 05:46

I have a WinForms application (VS 2008, .NET 3.5) that has a form with two different group boxes, and inside of each group box are different sets of radio buttons. When I r

8条回答
  •  心在旅途
    2021-01-16 06:29

    Set all the buttons' AutoCheck property to False. You'll now have to write a Click handler for them to set their Checked property. A sample handler that takes care of two of them:

      Private Sub RadioButton_Click(ByVal sender As Object, ByVal e As EventArgs) _
          Handles RadioButton1.Click, RadioButton2.Click
        Dim button As RadioButton = DirectCast(sender, RadioButton)
        RadioButton1.Checked = button is RadioButton1
        RadioButton2.Checked = button Is RadioButton2
      End Sub
    

提交回复
热议问题