Radio Buttons

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sc5502
    New Member
    • Jun 2014
    • 102

    Radio Buttons

    Background: MS VS/VB 2017 Professional

    I have a 10 radio buttons in one group. The default is none of them is checked. Is there a way to check them all to ensure one of them is checked?

    Thanks in advance.
  • Luk3r
    Contributor
    • Jan 2014
    • 300

    #2
    There is definitely a way to do this. Depending on whether or not your radio buttons sit on the main form or in some other type of container the below code would need modified.

    Code:
            For Each rButton In Controls.OfType(Of RadioButton)()
                If rButton.Checked = True Then
                    MsgBox(rButton.Name & " is checked")
                End If
            Next

    Comment

    • sc5502
      New Member
      • Jun 2014
      • 102

      #3
      Thank you very much.

      Comment

      Working...