Hi
I have xml file and try to load into datagridview, how can I save the xml after I sort it by desc?
Code:DS.ReadXml(Application.StartupPath & "\user.xml") Dim DS As New DataSet If DS.Tables(0).Rows.Count = 0 Then MsgBox("nothing") Else Dim i As Integer = 0 For Each r As DataRow In DS.Tables(0).Rows dtgUser.Rows.Insert(i, r("ID"), r("Name")) i = i + 1 Next End If dtgUser.Sort(dtgUser.Columns("ID"), System.ComponentModel.ListSortDirection.Ascending) Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click DS.WriteXml(Application.StartupPath & "\user.xml") End Sub




Reply With Quote
