B
bannaman
I am using the function below to returns a control to the recursionobj
object. For some reason when i get to the line 'If
child.ID.ToString.ToUpper = toFind.ToUpper Then' it errors saying
object reference not set to an instance of an object. Can anyone tell
me why this would happen?
Public Sub getControl(ByVal passedCtrl As Control, ByVal toFind As
String)
For Each child As Control In passedCtrl.Controls
If (TypeOf child Is TextBox) Or (TypeOf child Is
HiddenField) Or (TypeOf child Is Label) Then
If child.ID.ToString.ToUpper = toFind.ToUpper Then
recursionobj = child
End If
End If
If child.Controls.Count > 0 Then
getControl(child, toFind)
End If
Next
End Sub
object. For some reason when i get to the line 'If
child.ID.ToString.ToUpper = toFind.ToUpper Then' it errors saying
object reference not set to an instance of an object. Can anyone tell
me why this would happen?
Public Sub getControl(ByVal passedCtrl As Control, ByVal toFind As
String)
For Each child As Control In passedCtrl.Controls
If (TypeOf child Is TextBox) Or (TypeOf child Is
HiddenField) Or (TypeOf child Is Label) Then
If child.ID.ToString.ToUpper = toFind.ToUpper Then
recursionobj = child
End If
End If
If child.Controls.Count > 0 Then
getControl(child, toFind)
End If
Next
End Sub