AllAPI Network - The KPD-Team

 
Allapi Network
 API-Guide
 ApiViewer

 API List

 
API Resources
 Tips & Tricks
 VB Tutorials
 Error Lookup
 
Misc Stuff
 VB examples
 VB Tools
 VB Links
 Top Downloads
 
This Site
 Search Engine
 Contact Form
 

Donate to AllAPI.net

Recursively enable or disable controls in frames

This sub calls itself to recursively enable or disable controls in nested frames. This is much easier then going through by hand if you have several nested frames with controls in. For example:

EnableFrame fraMyFrame, True

This code will enable all controls in fraMyFrame.

Procedure

Public Sub EnableFrame(InFrame As Frame, ByVal Flag As Boolean)
'Recursive routine to
'set the enable property for all controls inside
'nested frames to true or false

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

 

 


Copyright © 1998-2007, The Mentalis.org Team - Privacy statement
Did you find a bug on this page? Tell us!
This site is located at http://allapi.mentalis.org/