by Dipen Anovadia (19 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 18th December 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Enable/Disable control in any frame
API Declarations
'Enable or Disable all the objects that are in any frame
'IN:
' f - Form
' fr - Frame Object
' bEnable - Enable OR Disable Value
'(OPTIONAL):
' bNoNestedFrame - Include nested frame object also!
'NOTE:
' If you include nested frame, the objects that are in nested frames are not changed, but
' the frame whole, itself is disabled.
' To disable all the object of nested frame, call seperately
'Variables...
Dim o As Object
Dim lhWnd As Long
On Error GoTo errFE
'Check all the objects...
For Each o In f
'Get container's hWnd...
lhWnd = o.Container.hwnd
'Verify and make enable or disable accordingly...
If lhWnd <> 0 And _
lhWnd = fr.hwnd Then
If Not (TypeOf o Is Frame And _
bNoNestedFrame) Then _
o.Enabled = bEnable
End If
Next o
Exit Sub
errFE:
'err 438, Object doesn't support this property or method.
'(As we don't know what the object is!)
If Err = 438 Then lhWnd = 0: Resume Next
MsgBox "Error " & Err & vbNewLine & vbNewLine & _
Error, vbCritical, f.Caption
Err.Clear
End Function
'Please tell me about bugs or suggestions... etc