CodeItBetter Programming Another VB Programming Blog

How to find if a control is part of a control array

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'Controls - How to find if a control is part of a control array
Option Explicit
 
Private Sub Form_Load()
    Dim ctl As Control
    For Each ctl In Me.Controls
        If IsControlArrayMember(ctl) Then
            Debug.Print ctl.Name & " is a part of a control array"
        Else
            Debug.Print ctl.Name & " is NOT a part of a control array"
        End If
    Next
End Sub
 
Public Function IsControlArrayMember(ByVal ctl As Control) As Boolean
    Dim index As Integer
    On Error GoTo IsControlArrayMember_Error
 
    index = ctl.index
    IsControlArrayMember = True
 
ExitHere:
    On Error GoTo 0
    Exit Function
 
IsControlArrayMember_Error:
    IsControlArrayMember = False
End Function
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.