VbCode Why doesn't it work. RRS feed

  • Question

  • Why doesn't my code work. I am working with vb.net 2003 and I was following an example in .net 2005.The code is very short.  I am only having a problem with one line. If someone test this out on there 2003 version You must have an xml file in th same folder that you have you executable named cars.xml. This code was placed in a button click event.  The xml file looks like this. The word  Oldsmobole Should appear in the textbox. HEELLLLPPP!!! I keep having a problemn with line 4, of which I highlighted in red.

    <? xml version="1.0" encoding ="utf-8" ?>








    1      Dim sr As New System.IO.StreamReader("Cars.xml")

    2      Dim xr AS New System.Xml.XmlTextReader(sr)

    3      Dim CarLotDoc AS New System.Xml.XmlDocument

    4      CarLotDoc.Load(xr)

    5      Label1.Text = CarLotDoc.InnerText

    Thursday, August 10, 2006 7:57 PM