daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Jan 15th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim direction As SortOrder
  2. .
  3. .
  4. .
  5.    
  6. direction = DataGridView1.SortOrder
  7. MsgBox(direction.ToString())
  8.    
  9. columnXY = DataGridView1.SortedColumn
  10. *' if no column set for sort use third one *
  11.         If columnXY Is Nothing Then
  12.             columnXY = DataGridView1.Columns(2)
  13.         End If
  14.  
  15. Dim SetSortOrder As ListSortDirection
  16. Dim GridSortOrder As SortOrder
  17. GridSortOrder = DataGridView1.SortOrder
  18.  
  19.         If GridSortOrder = Windows.Forms.SortOrder.Ascending Then
  20.             SetSortOrder = ListSortDirection.Ascending
  21.         ElseIf GridSortOrder = Windows.Forms.SortOrder.Descending Then
  22.             SetSortOrder = ListSortDirection.Descending
  23.         ElseIf GridSortOrder = Windows.Forms.SortOrder.None Then
  24.             SetSortOrder = ListSortDirection.Ascending
  25.         Else : GridSortOrder = ListSortDirection.Ascending
  26.             MsgBox("not good")
  27.         End If
  28.  
  29. DataGridView1.DataSource = datasetXY.Tables(0)
  30. DataGridView1.Sort(columnXY, SetSortOrder)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top