ousoonerjoe
Programmer
When attempting to remember the grid Sort Column and Sort Order to refresh the grid and return the user to the line they were at, the SortOrder does not seem to be playing well with others. When specifically defined as with the Select Case, the value reports correctly, but when expressed directly, it returns an error (The value of argument 'direction' (2) is invalid for Enum type 'ListSortDirection'.
Parameter name: direction). What is missing here? There should be no difference between the two.
--------------------------------------------------
Stubbornness is a virtue -- if you are right. --Chuck Noll
--------------------------------------------------
Parameter name: direction). What is missing here? There should be no difference between the two.
Code:
Dim SortOrder As System.ComponentModel.ListSortDirection
Select Case .dgTickets.SortOrder
Case Windows.Forms.SortOrder.Ascending
SortOrder = System.ComponentModel.ListSortDirection.Ascending
Case Windows.Forms.SortOrder.Descending
SortOrder = System.ComponentModel.ListSortDirection.Descending
Case Windows.Forms.SortOrder.None
SortOrder = System.ComponentModel.ListSortDirection.Ascending
End Select
SortOrder = .dgTickets.SortOrder
SortCol = .dgTickets.SortedColumn
.LoadGrid()
Application.DoEvents()
If Not SortCol Is Nothing Then
SortCol = .dgTickets.Columns(SortCol.Index)
.dgTickets.Sort(SortCol, SortOrder)
End If
--------------------------------------------------
Stubbornness is a virtue -- if you are right. --Chuck Noll
--------------------------------------------------