|
|
Title | See if a control is in a control array |
Description | This example shows how to see if a control is in a control array in Visual Basic 6. It uses an On Error Resume Next statement to protect itself while checking the cotrol's Index property. |
Keywords | control, control array, index |
Categories | Controls, Software Engineering |
|
|
The program uses an On Error Resume Next statement to protect itself and then tries to access the control's Index property. If the control is not in a control array, this raises an error.
|
|
' Return True if the control is in a control array.
Private Function IsInControlArray(ByVal ctl As Control) As _
Boolean
Dim i As Integer
On Error Resume Next
i = ctl.Index
IsInControlArray = (Err.Number = 0)
End Function
|
|
|
|
|
|