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)

------------------------------------------------------------------------


        
                  Book 1 <title/><br>                  <addby/><br>                  <date>2010-09-22T14:43:00.0000000+07:00</date><br>         </Table><br></NewDataSet><br><br>------------------------------------------------------------------------<br><br>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.<br><br>All the xml file which I got from GetXml is just like below (No declaration like <?xml version="1.0" encoding="utf-8" bla ?>)<br><br><NewDataSet><br>         <Table><br>                  <title> Book 1 <title/><br>                  <addby/><br>                  <date>2010-09-22T14:43:00.0000000+07:00</date><br>         </Table><br></NewDataSet><br><br><br><br>-------------------------------------------------------------------------<br><br><br>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. <br><br>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.<br><br>ds = New DataSet<br>path = System.IO.Path.GetFullPath(strFileToDecrypt)<br>ds.ReadXml(path)<br>DGV.DataSource = ds<br><br>(strFileToDecrypt is string which stored ".FileName" from SaveFileDialog)</div></article><section class="comments" id="replies"><header class="comments-head"><span class="comments-badge" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M3 3h10a2 2 0 0 1 2 2v4.5a2 2 0 0 1-2 2H7.5L4 14.5V11.5H3a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"></path></svg></span><div><h2 class="comments-title">4 Replies</h2><p class="comments-sub">Know the answer? Post it — somebody with the same question will find it here.</p></div></header><div class="comment-signin"><span class="comment-signin-badge" aria-hidden="true"><svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M11.5 3.5h3.2a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1h-3.2" stroke-linecap="round"></path><path d="M4.5 10h7" stroke-linecap="round"></path><path d="M8.8 7.2 11.6 10l-2.8 2.8" stroke-linecap="round" stroke-linejoin="round"></path></svg></span><div class="comment-signin-body"><p class="comment-signin-title">Sign in to <!-- -->answer this question</p><p class="comment-signin-text">It is the same account you read, post and publish with — and you will come straight back to this page.</p></div><div class="comment-signin-actions"><a class="btn primary-btn comment-signin-btn" href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help">Sign in</a><a class="comment-signin-alt" href="/register?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help">Create an account</a></div></div><ul class="comment-list"><li class="comment-thread"><article class="comment"><a class="comment-photo-link" href="/members/rudi-chendra" title="Rudi Chendra"><span class="comment-photo avatar-initials" title="Rudi Chendra" style="background-image:linear-gradient(135deg, #dc2626 0%, #991b1b 100%);font-size:16px" aria-hidden="true">RC</span></a><div class="comment-main"><div class="comment-head"><p class="comment-byline"><a href="/members/rudi-chendra" class="comment-author">Rudi Chendra</a><span class="posted-when" tabindex="0"><time class="posted-when-value comment-time" dateTime="2011-07-06T05:20:31.453Z">15y<!-- --> ago</time><span class="posted-when-pop" role="tooltip"><span>Posted<!-- --> <!-- -->Jul 6, 2011, 5:20 AM</span></span></span></p></div><div class="article-body">Thanks for helpful source. It's really a big help. thanks again.</div><div class="comment-foot"><span class="reply-vote"><a href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help" class="reply-vote-btn reply-vote-up" title="Sign in to vote up" aria-label="Vote up"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 2.5 14.5 12h-13z"></path></svg></a><span class="reply-vote-score" title="0 up, 0 down">0</span><a href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help" class="reply-vote-btn reply-vote-down" title="Sign in to vote down" aria-label="Vote down"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 13.5 1.5 4h13z"></path></svg></a></span></div></div></article></li><li class="comment-thread"><article class="comment"><a class="comment-photo-link" href="/members/vijay82" title="vijay"><span class="comment-photo avatar-initials" title="vijay" style="background-image:linear-gradient(135deg, #db2777 0%, #9d174d 100%);font-size:16px" aria-hidden="true">V</span></a><div class="comment-main"><div class="comment-head"><p class="comment-byline"><a href="/members/vijay82" class="comment-author">vijay</a><span class="posted-when" tabindex="0"><time class="posted-when-value comment-time" dateTime="2011-05-13T02:38:16.330Z">15y<!-- --> ago</time><span class="posted-when-pop" role="tooltip"><span>Posted<!-- --> <!-- -->May 13, 2011, 2:38 AM</span></span></span></p></div><div class="article-body">hi...try this links it may helpful to you load xml data<br /><a href="http://vbdotnetaddict.blogspot.com/2011/02/how-to-insert-xml-data-into-sql.html">http://vbdotnetaddict.blogspot.com/2011/02/how-to-insert-xml-data-into-sql.html</a></div><div class="comment-foot"><span class="reply-vote"><a href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help" class="reply-vote-btn reply-vote-up" title="Sign in to vote up" aria-label="Vote up"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 2.5 14.5 12h-13z"></path></svg></a><span class="reply-vote-score" title="0 up, 0 down">0</span><a href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help" class="reply-vote-btn reply-vote-down" title="Sign in to vote down" aria-label="Vote down"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 13.5 1.5 4h13z"></path></svg></a></span></div></div></article></li><li class="comment-thread"><article class="comment"><a class="comment-photo-link" href="/members/rudi-chendra" title="Rudi Chendra"><span class="comment-photo avatar-initials" title="Rudi Chendra" style="background-image:linear-gradient(135deg, #dc2626 0%, #991b1b 100%);font-size:16px" aria-hidden="true">RC</span></a><div class="comment-main"><div class="comment-head"><p class="comment-byline"><a href="/members/rudi-chendra" class="comment-author">Rudi Chendra</a><span class="posted-when" tabindex="0"><time class="posted-when-value comment-time" dateTime="2011-02-10T23:32:22.047Z">15y<!-- --> ago</time><span class="posted-when-pop" role="tooltip"><span>Posted<!-- --> <!-- -->Feb 10, 2011, 11:32 PM</span></span></span></p></div><div class="article-body forum-plain-text">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.^^</div><div class="comment-foot"><span class="reply-vote"><a href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help" class="reply-vote-btn reply-vote-up" title="Sign in to vote up" aria-label="Vote up"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 2.5 14.5 12h-13z"></path></svg></a><span class="reply-vote-score" title="0 up, 0 down">0</span><a href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help" class="reply-vote-btn reply-vote-down" title="Sign in to vote down" aria-label="Vote down"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 13.5 1.5 4h13z"></path></svg></a></span></div></div></article></li><li class="comment-thread"><article class="comment"><a class="comment-photo-link" href="/members/rudi-chendra" title="Rudi Chendra"><span class="comment-photo avatar-initials" title="Rudi Chendra" style="background-image:linear-gradient(135deg, #dc2626 0%, #991b1b 100%);font-size:16px" aria-hidden="true">RC</span></a><div class="comment-main"><div class="comment-head"><p class="comment-byline"><a href="/members/rudi-chendra" class="comment-author">Rudi Chendra</a><span class="posted-when" tabindex="0"><time class="posted-when-value comment-time" dateTime="2011-02-10T23:28:57.830Z">15y<!-- --> ago</time><span class="posted-when-pop" role="tooltip"><span>Posted<!-- --> <!-- -->Feb 10, 2011, 11:28 PM</span></span></span></p></div><div class="article-body forum-plain-text">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.^^</div><div class="comment-foot"><span class="reply-vote"><a href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help" class="reply-vote-btn reply-vote-up" title="Sign in to vote up" aria-label="Vote up"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 2.5 14.5 12h-13z"></path></svg></a><span class="reply-vote-score" title="0 up, 0 down">0</span><a href="/login?returnurl=%2Fforums%2Fcant-load-xml-file-into-datagridview-vb-net-please-help" class="reply-vote-btn reply-vote-down" title="Sign in to vote down" aria-label="Vote down"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 13.5 1.5 4h13z"></path></svg></a></span></div></div></article></li></ul></section></div></div><script>$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("S:2","P:2")</script><script>$RB=[];$RV=function(a){$RT=performance.now();for(var b=0;b<a.length;b+=2){var c=a[b],e=a[b+1];null!==e.parentNode&&e.parentNode.removeChild(e);var f=c.parentNode;if(f){var g=c.previousSibling,h=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d||"/&"===d)if(0===h)break;else h--;else"$"!==d&&"$?"!==d&&"$~"!==d&&"$!"!==d&&"&"!==d||h++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;e.firstChild;)f.insertBefore(e.firstChild,c);g.data="$";g._reactRetry&&requestAnimationFrame(g._reactRetry)}}a.length=0}; $RC=function(a,b){if(b=document.getElementById(b))(a=document.getElementById(a))?(a.previousSibling.data="$~",$RB.push(a,b),2===$RB.length&&("number"!==typeof $RT?requestAnimationFrame($RV.bind(null,$RB)):(a=performance.now(),setTimeout($RV.bind(null,$RB),2300>a&&2E3<a?2300-a:$RT+300-a)))):b.parentNode.removeChild(b)};$RC("B:1","S:1")</script><div hidden id="S:3"></div><script>$RC("B:3","S:3")</script><div hidden id="S:0"></div><script>$RC("B:0","S:0")</script></body></html>