GetControlsByTag – Find all the controls with the specified Tag value

GetControlsByTag – Find all the controls with the specified Tag value

' Find all the controls with the specified Tag value' Example:'    Dim ctrls() As Control = GetControlsByTag("OK", Me)'    Dim ctrl As Control'    For Each ctrl In ctrls'        Debug.WriteLine(ctrl.Name)'    NextFunction GetControlsByTag(ByVal tagToSearch As String, _    ByVal parentControl As Control) As Control()    Dim controlList As New System.Collections.ArrayList    ' add the parent control to the list, if its Tag matches the input string    If Not parentControl.Tag Is Nothing Then        If parentControl.Tag.ToString() = tagToSearch Then            controlList.Add(parentControl)        End If    End If    ' recursively call this routine for all the child controls    If parentControl.Controls.Count > 0 Then        Dim child As Control        For Each child In parentControl.Controls            ' add the results of the recursive GetControlsByTag call to the             ' current ArrayList            controlList.AddRange(GetControlsByTag(tagToSearch, child))        Next    End If    ' convert the ArrayList to an array of Controls, and return it    Return controlList.ToArray(GetType(Control))End Function

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several