Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2006

Tip: Looking for answers? Try searching our database.

ListView is extremely slow

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Teemu - 18 Mar 2006 11:25 GMT
I have a listview which contains about 500 items. I was pretty confused when
I realized that it takes over 50 milliseconds to get
Listview.CheckedItems.Count value. How it can be so slow?

In ItemChecked event I have code which sets text "3 items selected" to a
label. When I turn CheckBoxes to True you can imagine how long it takes.

I'm using Visual Basic 2005.

Any good ideas?

Thanks,
Teemu
Cerebrus - 19 Mar 2006 07:21 GMT
Hi,

Virtual ListView seems the way to go.

There are many samples available. Don't know if they're available for
VS 2005.

Here's one that you can try :

http://www.windowsforms.com/ControlGallery/ControlDetail.aspx?Control=214&tabindex=9

Also, an MSDN article on how to create a Virtual Listview:

http://msdn.microsoft.com/downloads/samples/internet/default.asp?url=/downloads/
samples/internet/commctrl/vlistvw/default.asp


Hope this helps,

Regards,

Cerebrus.
Jason Newell - 20 Mar 2006 19:36 GMT
Teemu,

I would give LVM_GETITEMCOUNT a try to see if it's any faster.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platfor
m/commctls/listview/messages/lvm_getitemcount.asp


Declare Function SendMessage Lib "User32.dll" (ByVal hWnd As IntPtr,
ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer)
As IntPtr

LVM_FIRST = 0x1000
LVM_GETITEMCOUNT = (LVM_FIRST + 4)

Jason Newell

> I have a listview which contains about 500 items. I was pretty confused
> when I realized that it takes over 50 milliseconds to get
[quoted text clipped - 9 lines]
> Thanks,
> Teemu
Jason Newell - 20 Mar 2006 21:27 GMT
Totally sorry, I missed the "Checked" statement.  I'll repost if I can
think something else up.

Jason Newell

> Teemu,
>
[quoted text clipped - 25 lines]
>> Thanks,
>> Teemu
Claes Bergefall - 20 Mar 2006 21:21 GMT
Not surprising actually. CheckedItems.Count actually loops over all items in
your list box and counts the ones that are checked.
How about keeping a counter yourself? Then you only need to add or subtract
1 in the ItemChecked event

  /claes

>I have a listview which contains about 500 items. I was pretty confused
>when I realized that it takes over 50 milliseconds to get
[quoted text clipped - 9 lines]
> Thanks,
> Teemu

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.