John

John

  • NA
  • 3
  • 0

Linq nullReferenceException problem

Dec 21 2008 9:26 AM
Here's my code:

Dim strURLSearch As String
        strURLSearch = "http://isbndb.com/api/books.xml"
        strURLSearch = strURLSearch & "?access_key=CYGCL3GT"
        strURLSearch = strURLSearch & "&index1=isbn&value1=" & Me.txtISBN.Text

        Dim xResults As XElement = XElement.Load(strURLSearch)


       

        Dim books = From BookData In xResults.Descendants("BookData") Select Title = BookData.Element("Title").Value, Author = BookData.Element("AuthorText").Value, Publisher = BookData.Element("PublisherText").Value
        For Each BookData In books
            Me.txtResults.Text = Me.txtResults.Text & BookData.Author & vbCrLf
        Next


On the For Each loop, I'm getting a NullReferenceException error

Answers (1)