We are trying to read information from a separate XML document.
This is the code we have:
'load the XMLTest document containing cars.
Dim xml As XDocument = XDocument.Load("CreditApp.xml")
Dim SSN As String = txtSSN.Text
'get all car makes that are red.
Dim query = From xe In xml.Descendants("SSN")
Where xe.Element("SSN").Value = SSN
Select New With {
.FName = xe.Element("FName").Value 'Error in code is here
}
'loop through query result output results.
For Each element In query.ToArray
MessageBox.Show(element.FName)
Next
We are getting the error:
Object reference not set to an instance of an object.
We are not sure what it is refering too.