Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleSee if a control is in a control array
DescriptionThis 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.
Keywordscontrol, control array, index
CategoriesControls, 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
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated