What is the default value for ListBox.ColumnSortDirection ?

The subject says all:

What is the default value for Listbox.ColumnSortDirection(ColNum) ?

Hint: the value is not Listbox.SortNone.

Edit:
I want to clear the Listbox current sort (and then clear the Listbox contents).

ColumnSortDirection only changes the direction a particular column, but doesn’t actually do the sort. You also need to set the SortedColumn property to specify which column (and show the sort indicator) and then call the Sort() method.

To do what you want, set SortedColumn to -1.

Hi Greg.

I will rephrase this question:
What is best: doing things in code (clear Listbox, reset the header to no nort icon) or simply close the window and open a brand new one ?

I now understand that my last sentence is ambiguous (at most).
What I want to do is to reset the Listbox (thus the new frmulation of the question above).

Thanks all.

I certainly had a lack in my explanations above.

What I really want to do is to reset the Listbox to its defaults values (using a MenuHandler).

The code below let the Sort badge icon in place…

[code]Function EditResetListbox() As Boolean
// Remove all Rows
LB.DeleteAllRows

// Reset the number of Columns and reset the default properties
If LB.ColumnCount > 1 Then
// a. Reset the Column Count
LB.ColumnCount = 1

// b. Reset the ColumnWidths value
LB.ColumnWidths = "*"

// c. Reset the Headings
LB.Heading(-1) = ""

// d. Reset the Sorted Direction
LB.SortedColumn = -1

// e. Reset the Column Sort Direction
LB.ColumnSortDirection(-1) = Listbox.SortDescending // -1 does not do the trick…

End If

// Handled !
Return True
End Function[/code]

This code comes from a blank project with only one window and ine Listbox in that window. It needs adaptation for a real world project.

Oh, you might need to flicker the listbox header to get it to refresh.

ListBox.HasHeading = false ListBox.SortedColumn = -1 ListBox.HasHeading = true

Hi Tim,

this recalls me something (what ?). I test it right now and…

all is OK excepter that a click in the Heading (all of them) does not Sort the clicked column… :frowning:

BTW: I commented the LB.ColumnSortDirection(-1) line, no change.

I will try with crossed fingers… :wink:

[time to go to bed…]

Set HeadingIndex to -1.

That was it Tim !

Thank you.