Last tabcontrol-related question, I promise.
So last time I was having visibility issues with this subroutine and now those have been sorted out, but I still have another issue. When I click over to a tab other than the first one and then run the sub, it suddenly shows all the controls from the first tabpage instead of those from the current tabpage. Then, if I click to another tab and back, the problem disappears and it all looks correct again. See below; the Fragments tab is selected, but it's showing all the controls from the Assessments tab instead:
![Name: ss5.png
Views: 38
Size: 14.8 KB]()
And here's the subroutine:
In case anyone's wondering, I've been able to comment out all the code on the form (the subroutine is in a module) and still replicate the problem.
So last time I was having visibility issues with this subroutine and now those have been sorted out, but I still have another issue. When I click over to a tab other than the first one and then run the sub, it suddenly shows all the controls from the first tabpage instead of those from the current tabpage. Then, if I click to another tab and back, the problem disappears and it all looks correct again. See below; the Fragments tab is selected, but it's showing all the controls from the Assessments tab instead:
And here's the subroutine:
Code:
Public Sub ConcealObject(ByVal Parent As Control)
For Each C As Control In Parent.Controls
'conceals the control if necessary
If C.Enabled = False AndAlso Not TypeOf C Is TabPage Then 'tabpages that don't have focus count as invisible, hence this check
C.Visible = False
ElseIf C.HasChildren Then
If TypeOf C Is TabPage Then 'shows each tab page momentarily so it'll count as visible
C.Show()
End If
ConcealObject(C) 'repeats the loop at the next level down (will keep repeating for as many levels as there are)
'NOTE: This can't turn into an endless loop because it's always going down a level and control inheritance can't be cyclical
End If
Next C
End Sub