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

Related posts:

  1. How to write a string array to a text file
  2. How to Read a file and add each line to an array of strings
  3. How to find out the number of dimensions of the given array
  4. How to sort an array
  5. How to evaluate the total number of elements in a two dimensional array
  6. How to delete an item in an array
  7. How to Find First Numbers of String (along with alphas & decimals)
  8. How to insert an item in an array
  9. How to Copy array data into a FlexGrid control
  10. How to clear the contents of all the items in an array of TextBox controls

Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.