Programming » Visual Basic 6 » Visual Basic 6 Code » Controls » ");?>
Disable all controls contained in a frame so that the controls look disabled.
Private Sub EnableFrame(InFrame As Frame, ByVal Flag As Boolean)
    Dim Contrl As Control

    On Error Resume Next    'not all controls have a container property
    InFrame.Enabled = Flag
    For Each Contrl In InFrame.Parent.Controls
        If Contrl.Container.Name = InFrame.Name Then
            If (TypeOf Contrl Is Frame) And Not (Contrl.Name = InFrame.Name) Then
                EnableFrame Contrl, Flag    'repeat for nested frame
            Else
                Contrl.Enabled = Flag
            End If
        End If
    Next
End Sub