I am trying to cycle through a specific set of controls. I do this 2 or 3 times on the form so I figured it best to create an array with the controls I want and cycle through that.
Here is me setting the array up.
I have tried a couple different variations but it seems like the problem lies with the way I am setting the controls in the array?Code:Dim DebugControls(0 To 7) As Control Private Sub Form_Open(Cancel As Integer) Set DebugControls(0) = Me.ImmediateTxtFront Set DebugControls(1) = Me.ImmediateLblFront Set DebugControls(2) = Me.ImmediateTxtBack Set DebugControls(3) = Me.ImmediateLblBack Set DebugControls(4) = Me.RecreateConnectionsBttn Set DebugControls(5) = Me.ClearImmediateWindowBttn Set DebugControls(6) = Me.ClearFormBttn Set DebugControls(7) = Me.HideDebugMenuBttn End Sub Private Sub DebugBttn_Click() Dim name As Variant, i As Integer: i = 0 For Each name In DebugControls Select Case i Case 2 Case 3 Case Else DebugControls(i).Visible = True End Select i = i + 1 Next End Sub
I tried it without the "Set" but it would just throw me an error.
Edit: Also would it be better to use something like "For i = 0 to 7"?