TheSwamp
Code Red => VB(A) => Topic started by: NYacad on May 29, 2007, 09:56:25 AM
-
How to change in VB6 ListBox Sorted property while loading form?
Primitive
Private Sub Form_Initialize()
List1.Sorted = True
End Sub
does not work.
Thank you,
Alex Borodulin
http://www.nyacad.com
alex@nyacad.com
-
The sort property of a listbox can only be set at design time. You will need to write your own procedure to sort the listbox.
-
In VB6 the list sorting happens when the value is changed, not when the list is populated, thus you would need to populate the listbox first, then set the sorting to true.
This is an example of having a multiple column listbox where the column can be sorted by any column, depending upon which column you select.
Private Sub listView_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
listView.SortKey = ColumnHeader.Index - 1
listView.Sorted = True
End Sub