954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Save datagridview to xml?

I have a datagridview on my form called "mainGrid" and im not very good with XML buti found a small example to load but not one to save
I wondered if there was a equally simple way to save! Heres the loading code:

Private Sub loadGrid()
        Dim ds As DataSet = New DataSet
        ds.ReadXml("C:\x\tsst.xml")
        Dim dv As DataView = New DataView(ds.Tables(0))
        mainGrid.DataSource = dv
End Sub

as you can see it is very simple and i didnot have to manually do anything i was wondering if it was the same for saving or if not how i could do it thanks
any questions etc. just ask i will reply!

DJAyzed
Newbie Poster
8 posts since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

[b]>I wondered if there was a equally simple way to save![/d]

...
ds.WriteXml("filename.xml");
// OR
ds.Tables["tableName"].WriteXml("filename.xml");
 ...
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

I had tried this, but im pretty sure that it would just write the code from the original file since ds is not bound to the datagridview?
Im sorry, i dont know much about XML how would you bind the dataset to the gridview?

DJAyzed
Newbie Poster
8 posts since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: