By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,616 Members | 2,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,616 IT Pros & Developers. It's quick & easy.

Radio Buttons

100+
P: 102
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.
Jun 29 '17 #1

✓ answered by Luk3r

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.

Expand|Select|Wrap|Line Numbers
  1.         For Each rButton In Controls.OfType(Of RadioButton)()
  2.             If rButton.Checked = True Then
  3.                 MsgBox(rButton.Name & " is checked")
  4.             End If
  5.         Next

Share this Question
Share on Google+
2 Replies


100+
P: 299
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.

Expand|Select|Wrap|Line Numbers
  1.         For Each rButton In Controls.OfType(Of RadioButton)()
  2.             If rButton.Checked = True Then
  3.                 MsgBox(rButton.Name & " is checked")
  4.             End If
  5.         Next
Jun 29 '17 #2

100+
P: 102
Thank you very much.
Jun 29 '17 #3

Post your reply

Sign in to post your reply or Sign up for a free account.