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:
- How to write a string array to a text file
- How to Read a file and add each line to an array of strings
- How to find out the number of dimensions of the given array
- How to sort an array
- How to evaluate the total number of elements in a two dimensional array
- How to delete an item in an array
- How to Find First Numbers of String (along with alphas & decimals)
- How to insert an item in an array
- How to Copy array data into a FlexGrid control
- How to clear the contents of all the items in an array of TextBox controls