Can't load XML File into DataGridView (VB.Net), please help
I generate my xml into "variable string str" by using "dataset.GetXml"
and then I write the "xml which is contained in variable str" into
"file.xml" by using "sFile.WriteLine(str) while 'sFile' is a stream
reader"
My reason for using 'writeline' instead of
'dataset.WriteXml' because I need to encrypt the 'xml stored in 'str'
before I store it into file.xml.
I got everything fine for the encrypted result, and so does the decrypted result as well.
Here's
the decrypted result of my file.xml below (I have checked it the xml
value which in str before encryption and which in decrypted file.xml.
They are all match well)
------------------------------------------------------------------------
<NewDataSet>
<Table>
<title> Book 1 <title/>
<addby/>
<date>2010-09-22T14:43:00.0000000+07:00</date>
</Table>
</NewDataSet>
------------------------------------------------------------------------
Here
is my plain xml value before it got encrypted or decrypted which I
stored it in variable str by using GetXml. I don't know for sure but my
xml value doesn't contain declaration "<?xml version="1.0"
encoding="utf-8" standalone="yes" ?>" like common xml used to have.
All
the xml file which I got from GetXml is just like below (No declaration
like <?xml version="1.0" encoding="utf-8" bla ?>)
<NewDataSet>
<Table>
<title> Book 1 <title/>
<addby/>
<date>2010-09-22T14:43:00.0000000+07:00</date>
</Table>
</NewDataSet>
-------------------------------------------------------------------------
And
since I think it may not cause any problem then I keep coding and
decrypt it which is going well and the decrypted result is perfectly
same ofcourse.
My problem is, when I try to make my xml value
show in Data GridView by using the code below, and run the debug, it
prompt an error said "could not find the file c:\bla\File.xml ". Please
help and thanks for any reviewing or suggestion too.
ds = New DataSet
path = System.IO.Path.GetFullPath(strFileToDecrypt)
ds.ReadXml(path)
DGV.DataSource = ds
(strFileToDecrypt is string which stored ".FileName" from SaveFileDialog)