0

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!

Edited by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

2
Contributors
2
Replies
8
Views
7 Years
Discussion Span
Last Post by DJAyzed
0

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

...
ds.WriteXml("filename.xml");
// OR
ds.Tables["tableName"].WriteXml("filename.xml");
 ...

Edited by __avd: n/a

0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.