G
Guest
I keep getting the following error! I'm sure it is a really simple problem
but just can't see what is causing it!
The error occors on the FOR line!
I would really appritiate any advice.
Thanks
...:: ERROR
Object reference not set to an instance of an object.
...:: CODE
Function GetSelectedIndex(ByVal OID As String) As Integer
Dim iLoop As Integer
Dim dt As DataTable = ddlDataSet.Tables("Offices")
For iLoop = 0 To dt.Rows.Count - 1
If Int32.Parse(OID) = Int32.Parse(dt.Rows(iLoop)("officeID")) Then
Return iLoop
End If
Next iLoop
End Function
but just can't see what is causing it!
The error occors on the FOR line!
I would really appritiate any advice.
Thanks
...:: ERROR
Object reference not set to an instance of an object.
...:: CODE
Function GetSelectedIndex(ByVal OID As String) As Integer
Dim iLoop As Integer
Dim dt As DataTable = ddlDataSet.Tables("Offices")
For iLoop = 0 To dt.Rows.Count - 1
If Int32.Parse(OID) = Int32.Parse(dt.Rows(iLoop)("officeID")) Then
Return iLoop
End If
Next iLoop
End Function