Solved

Sorting ListIVews faster

Posted on 2003-11-10
5
196 Views
Last Modified: 2010-04-16
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.
0
Comment
Question by:jjacksn
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:sedmans
ID: 9714744
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
 
LVL 5

Author Comment

by:jjacksn
ID: 9716504
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
 
LVL 11

Expert Comment

by:Agarici
ID: 9721219
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
 
LVL 5

Author Comment

by:jjacksn
ID: 9725595
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
 
LVL 11

Accepted Solution

by:
Agarici earned 150 total points
ID: 9730023
try calling BeginUpdate before starting the sort and EndUpdate after. those functions will  disable/enable the redrawing of the control during the sorting
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Check my code out(2) 2 54
Visual Studio 2013 debugging 2 35
WKHTMLTOPDF - --disable-smart-shrinking not working 10 36
ASP.NET 5 Templates 2 66
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now