Valhalla Legends Forums Archive | Visual Basic Programming | Information on Listview

AuthorMessageTime
Imperceptus
While attepting to Improve the speed of how things get done, I recently Found out that if you have a ListView Control with its Sorted value set to true, then every time you add a row ("row if your using report view"), the list view will resort everything based off of last sort & new data. Not a big problem if for say you had a list of people in a channel and you were sorting by some flag. Major problem if you are Sorting a rather large amount of data (in this case more then 1300 rows ). I am currently disabling the sorted.true option while adding more data to the ListView. You can also set the visible property of the listview to false to improve update time.

Code for Sorting Rows when ListView.View = 3 - lvwReport
[code]
Public Sub SortList(ctlListView As ListView, intColulunHeaderIndex As Integer, Optional Ascending As Boolean, Optional Descending As Boolean)
ctlListView.Refresh
DoEvents
ctlListView.Sorted = True
ctlListView.SortKey = intColulunHeaderIndex
If Ascending = True Then
ctlListView.SortOrder = lvwAscending
ElseIf Descending = True Then
ctlListView.SortOrder = lvwDescending
Else
If ctlListView.SortOrder = lvwAscending Then
ctlListView.SortOrder = lvwDescending
Else
ctlListView.SortOrder = lvwAscending
End If
End If
DoEvents
ctlListView.Refresh
End Sub
[/code]

Just thought I would post the information to inform others that might need to know at some point or another.

Fixed - Spelling Error
August 17, 2004, 2:47 PM

Search