Public Function FindChildByName(ByRef name As String, ByVal par As Control) As Control
Dim c As Control = Nothing
Dim cc As Control
For Each cc In par.Controls
If cc.Name = name Then
Return cc
End If
If cc.Controls.Count > 0 Then
c = FindChildByName(name, cc)
If Not (c Is Nothing) Then
Return c
End If
End If
Next cc
Return Nothing
End Function 'FindChildByName
Public Function FindObjectByName(ByVal name As String) As Control
Dim c As Control = Nothing
If Not (Me.Parent Is Nothing) And Me.Parent.Controls.Count > 0 Then
Dim cc As Control
For Each cc In Me.Parent.Controls
If cc.Name = name Then
Return cc
End If
If cc.Controls.Count > 0 Then
c = FindChildByName(name, cc)
If Not (c Is Nothing) Then
Return c
End If
End If
Next cc
End If
Return Nothing
End Function 'FindObjectByName