On my web site some users are getting a "Selection out of range" error on one of my combo boxes when I populate it with values. I can' seem to reproduce this error. Any ideas on what might cause this problem? Below is the code that I am using to populate the combobox. Any help would be greatly appreciated.
Jason
Dim blankStreet As New mystreetTypeObject
Dim streetTypes As New myStreetTypeObjectList
Jason
Dim blankStreet As New mystreetTypeObject
Dim streetTypes As New myStreetTypeObjectList
With blankStreet
.AddressType = "N/A"
.TypeDescription = "N/A"
End With
'Retrieve the list of available street types from our database.
streetTypes = GetStreetTypes()
If (streetTypes IsNot Nothing) Then
Dim stTypes As New List(Of mystreetTypeObject)
For Each streetType As mystreetTypeObject In myStreetTypeObjectList.StreetTypes
stTypes.Add(streetType)
Next
ddlStreetType.DataTextField = "Description"
ddlStreetType.DataValueField = "AddressType"
stTypes.Insert(0, blankStreet)
ddlStreetType.DataSource = stTypes
ddlStreetType.DataBind()
Else
Throw New Exception("Unable to retrieve the list of available street types.")
End If