We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,703 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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!

2
Contributors
2
Replies
1 Day
Discussion Span
3 Years Ago
Last Updated
6
Views
DJAyzed
Newbie Poster
8 posts since Dec 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

>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,736 posts since Oct 2008
Reputation Points: 2,141
Solved Threads: 1,262
Skill Endorsements: 50

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
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.2829 seconds using 2.64MB