Tools Links Login

enableFrame

When you disable a Frame then all controls in it are disabled to, nice feature, but to the users it still looks like if the controls as enabled.
So I wrote a little subroutine which en/disables all controls in a frame. Can be handy sometimes :-)

Original Author: Arnout de Vries

Code

Option Explicit
Public Sub enableFrame(curFrame As Frame)
' purpose:
'  set the .enabled property of all controls on a frame to
'  the same state as the enabled state of the current frame
Dim ctl As Control

' Loop through all controls on the current form
For Each ctl In curFrame.Parent.Controls
  On Error Resume Next        ' error checking, because not every control has
                    ' a container property
  If ctl.Container.hWnd = curFrame.hWnd Then
   If Err.Number = 0 Then      ' if we didn't receive an error code, proceed
    ctl.Enabled = curFrame.Enabled ' state of control same as Frame
    If TypeOf ctl Is Frame Then   ' if the control is a frame itself then
     enableFrame ctl        ' enter this procedure again for the current frame
    End If
   End If
  End If
Next ctl
End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 85 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.