-
I have a lot of labels (label1) and I made them all a label control array I also have shapes which I also made into a control array, I made sure that there is the same of both. my goal is to make it so that is label1(1).visible = false, then shape1(1).visible = false. but I dont want to write it out for every single label and shape so I tried this code and it did not work, whats wrong with is:
Code:
if label1(index as Integer).Visible = False then
shape1(index as Integer).Visible = False
End If
if the code is just stupid can someone please give me the correct
-
assuming u have n labels and shapes
for index = 1 to n
shape1(index).visible = label1.visible
next index
it can be done more nicely with a for each loop, but i cant rem how at the moment
-
-
Or you could do this:
Code:
Dim MyControl As Control
For Each MyControl In Me.Controls
If TypeOf MyControl Is Label Then MyControl.Visible = False
If TypeOf MyControl Is Shape Then MyControl.Visible = False
Next
-
thanks but the other one is a little shorter