Sorting ListIVews faster

I have a listView with roughly 2000 items in it.  When I use a pretty basic ListViewSorter that I wrote, the ListView disappears for about 1 second while it is being sorted, then reapperas when it is done.  I have two questions:

1:  Is there a faster/better way to do a sort.
2.  Is there anyway I can leave the artifact of the old ListView up while it is sorting the rows?  If not, any suggestions as to how to make this look better to the user.
LVL 5
jjacksnAsked:
Who is Participating?
 
AgariciConnect With a Mentor Commented:
try calling BeginUpdate before starting the sort and EndUpdate after. those functions will  disable/enable the redrawing of the control during the sorting
0
 
sedmansCommented:
The listview control has got a Sorting property that allows you to sort the items.  If this does not perform the sorting that you require you can call the BeginUpdate method which should stop the drawing of the control and when your sorting has finished you call the EndUpdate method to draw the control.
0
 
jjacksnAuthor Commented:
BeginUpdate just freezes the drawing of the control? One thing I'm wonder:  I don't tell the listView to Hide, so what is causing it to disappear?
0
 
AgariciCommented:
it 'disapears' because the list view window does not respond when the system asks for a redraw (it does not respond because it is stuck in the sorting procedure you wrote)
0
 
jjacksnAuthor Commented:
So is there a good fix to have listView stay appearing not sorted until the sort procedue has completed, then redraw?  (how do mail programs do it so fast?)
0
All Courses

From novice to tech pro — start learning today.