Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with an awfull lot off checkboxes

Status
Not open for further replies.

jokko

Technical User
Apr 3, 2005
4
NL
Dear reader,

I am writing a program to determine how to connect power cables to electric panels and a userform with a diagram and 36 checkboxes seems to build an excellent interface. I want to use the checkboxes in the diagram to let the program show me what to do.

The only thing I could come up with would look something like this:

checkbox1.value = false
checkbox2.value = false
'
'
'
etc

if condition1 =true then
checkbox1.value = true
end if

if condition2 =true then
checkbox2.value = true
end if
'
'
'
etc.

Now with 36 checkboxes this will be an awfull lot off code. I think there must be a shorter way of doing this and I think class modules are the key. I can´t figure out how though. Does anybody have a sugestion?

Thanks in advance. Jokko


 
One way to shorten the code:
Me.CheckBox1 = condition1
..
Me.CheckBox36 = condition36

But the real point is: what are conditionX ?

Another starting point:
Dim i As Integer
For i = 1 To 36
Me.Controls("CheckBox" & i) = True
Next i

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV this is what I was looking for it works!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top