Private m_Enabled As Boolean
Private Sub PrivateMDI_Enable()
m_Enabled = True
End Sub
Private Sub UserControl_Show()
Dim ctl As Object
If Not m_Enabled Then
For Each ctl In _
UserControl.Controls
ctl.Visible = False
Next ctl
lblPrivate.Visible = True
Else
lblGreeting.Caption = _
"Welcome " & m_User
End If
End Sub
Listing 3 Controlling access to a private control is accomplished using a private interface and code to restrict the functionality of the control outside the main MDI application.