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

VB 2005 RadioButtons

P: 4
I have a VB 2005 form with 140 different radiobuttons...

Some are "checked", some are not...

I want to reset all radiobuttons to "unchecked".

I've been searching and trying differnet things...there must be a way to access radiobuttons by their "names"...

Typical names used include...
RadioButton011
RadioButton012
RadioButton013
...
RadioButton285

28 rows of 5 radiobuttons = 140 radiobuttons

I would like to cycle through the radiobutton list via 2 nested loops to inquire the status of each radiobutton...

Is there a way to concatenate the name of the radiobutton?????

Typical code to do the inquiry would be as follows...

For I = 1 to 28
For I2 =1 to 5
if ("RadioButton" & I & I2).checked = True then
...do something...
next I2
next I

I'm stuck now for 3 days...need help...all help appreciated!

Pete
Dec 20 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 5K+
P: 8,434
I don't use VB2005, but have you tried looking for a Controls collection? That's what was used in VB6.
Dec 20 '07 #2

P: 4
I have tried using the CONTROLS method...but there is something "special" about radiobuttons...it doesn't seem to recognize radiobuttons...

Still stuck!!
Dec 20 '07 #3

daniel aristidou
100+
P: 491
Have you tried creating a function ?.......else use array.
Dec 20 '07 #4

Expert 5K+
P: 8,434
There are a number of earlier discussion threads here in the VB forum which cover the topics of simulating control arrays in the various .Net versions of VB, and accessing controls by variable names. Here are a few you can try...

http://www.thescripts.com/forum/thre...rol+array.html
http://www.thescripts.com/forum/thre...rol+array.html
http://www.thescripts.com/forum/thre...rol+array.html
http://www.thescripts.com/forum/thre...rol+array.html
http://www.thescripts.com/forum/thre...rol+array.html

Note, some words will be highlighted because these links were the result of a search on "simulate control array".
Dec 20 '07 #5

Post your reply

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