Dropdown list + XML = Object reference not set to an instance of an object.

D

darrel

I keep getting a " Object reference not set to an instance of an object. "

I'm using Dreamweaver and rebuilding a few pages that were produced in
VS.net. The original page seems to work fine, the new one does not.

Here's the code in question:

If IsPostBack Then
Else
Dim CountyData As New DataSet()
Try
CountyData.ReadXml(MapPath("County.xml"))
DropDownListCounty.DataSource = CountyData
DropDownListCounty.DataValueField = "CountyNumber"
DropDownListCounty.DataTextField = "CountyName"
DropDownListCounty.DataBind()
Catch objError As System.Exception
response.write ("Error Loading County XML - Contact
Administrator.<br />" _
& objError.Message & "<br />" & objError.Source)
Exit Sub
End Try


I should know what the "Object reference not set to an instance of an
object." means, but I'm not sure what, specifically, the reference is. I
think I need to set "DropDownListCounty" to ian instance of a DropDownList?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top