Recursively Find Control
Public Shared Function RecursiveControl(ByVal ctlCollection As ControlCollection, ByVal findControl As String, ByVal findType As System.Type, ByRef foundControl As Control) As Control
'loops through all the child controls
Dim idx As Integer = 0
Dim ctl As Control
Do While idx < ctlCollection.Count AndAlso IsNothing(foundControl)
ctl = ctlCollection.Item(idx)
' Found Control
If ctl.GetType Is findType Then
If Not IsNothing(ctl.ID) Then
If ctl.ID.IndexOf(findControl) > -1 Then
foundControl = ctl
End If
End If
End If
' Recurse
If ctl.HasControls AndAlso IsNothing(foundControl) Then
RecursiveControl(ctl.Controls, findControl, findType, foundControl)
End If
idx += 1
Loop
' Return
Return foundControl
End Function
Monday, May 31, 2004
Integer Querystring Best Practice
Try
Catch exNull As ArgumentNullException
ESVldSum.AddErrorMessage("Null Signal Job Id")
Catch exFormat As FormatException
ESVldSum.AddErrorMessage("Invalid Signal Job Id")
Catch exOverflow As OverflowException
ESVldSum.AddErrorMessage("Invalid Signal Job Id")
End Try
