Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim direction As SortOrder
- .
- .
- .
- direction = DataGridView1.SortOrder
- MsgBox(direction.ToString())
- columnXY = DataGridView1.SortedColumn
- *' if no column set for sort use third one *
- If columnXY Is Nothing Then
- columnXY = DataGridView1.Columns(2)
- End If
- Dim SetSortOrder As ListSortDirection
- Dim GridSortOrder As SortOrder
- GridSortOrder = DataGridView1.SortOrder
- If GridSortOrder = Windows.Forms.SortOrder.Ascending Then
- SetSortOrder = ListSortDirection.Ascending
- ElseIf GridSortOrder = Windows.Forms.SortOrder.Descending Then
- SetSortOrder = ListSortDirection.Descending
- ElseIf GridSortOrder = Windows.Forms.SortOrder.None Then
- SetSortOrder = ListSortDirection.Ascending
- Else : GridSortOrder = ListSortDirection.Ascending
- MsgBox("not good")
- End If
- DataGridView1.DataSource = datasetXY.Tables(0)
- DataGridView1.Sort(columnXY, SetSortOrder)
Add Comment
Please, Sign In to add comment