Hi again
So i have a datatable and its sorted like this.
And in the dgv the records displayed as it is intended to.
I want to export the datatable to a text file but when i do the output is still unsorted. The output text writes the records in the order they were added. How do I export it in the same order as it was sorted in?
So i have a datatable and its sorted like this.
Code:
playerOleDbDataAdapter1.Fill(PvpleaderboardDataSet.Players)
playerDataGrid.Sort(playerDataGrid.Columns(0), ListSortDirection.Descending)
I want to export the datatable to a text file but when i do the output is still unsorted. The output text writes the records in the order they were added. How do I export it in the same order as it was sorted in?
Code:
Dim writer As New StreamWriter("C:\Leaderboard\Leaderboard.txt", False)
Dim num As Integer = 1
For Each row As DataRow In PvpleaderboardDataSet.Players.Rows
writer.Write(String.Format("{0,-10}{1,-10}{2,-30}{3,-30}{4,-30}{5,-15}{6,-10}{7,-10}", num, row("Rating"), row("Player Name"), row("Account"), row("Profession"), row("Total Played"), row("Wins"), row("Losses")))
writer.WriteLine()
num = num + 1
Next
writer.Close()