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)

Please Help me, I can't make my decrypted file.xml load in DataGridView. I have tried hard

After, I hurry in my effort, I got my own solving way which really working good.
I never think to answer it mayself until I make a message box this is it just now and I got the answer hore.

My problem just in the path and here's my code which worked.

xmlDatadoc = New XmlDataDocument
path = System.IO.Path.GetFullPath(pk)
MsgBox("Ini Dia" & path)
xmlDatadoc.DataSet.ReadXml(path)
ds = New DataSet
ds = xmlDatadoc.DataSet
DGV.DataSource = ds.DefaultViewManager

Happy to solve it.^^

Finally, I got my own working path worked.^^ You know, since I changed the name of the xml file after encryption, I forget to use the same name for decryption. But know I got it, I called it a day.^^

This article has been dead for over six months. Start a new discussion instead.