Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27153

Children of tabcontrol

$
0
0
I'm using this subroutine to recursively toggle disabled/invisible state for a control and its children:

Code:

    Public Sub ConcealObject(ByVal Parent As Control)
            For Each C As Control In Parent.Controls
                'conceals the control
            If C.Enabled = False OrElse C.Visible = False Then
                If CStr(C.Tag) <> "noconceal" Then 'a tag that are either never disabled or never hidden and thus shouldn't be toggled
                    Conceal(C)
                End If
            ElseIf C.HasChildren Then
                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

This works for everything except tabcontrols. On a tabcontrol, it hides/disables the correct fields on the front tabpage, but not any of the other pages. If I click on a different tabpage and then run the subroutine, it will hide/disable the controls on that page correctly, but that page only. How can I make it run through all the controls on all the tab pages every time?

Viewing all articles
Browse latest Browse all 27153

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>