Groups | Blog | Home
all groups > dotnet windows forms > june 2005 >

dotnet windows forms : ListView_Problem_/Mystery.


Steph.
6/29/2005 12:00:00 AM
Hi !

=20

I use a ListView in a form to display Data from an SQL db.

=20

My problem is that I can fill the listview in less than a second when I =
show the form AFTER filling the listview, but I take 35 seconds if I =
show the form BEFORE filling the listview !!!=20

=20

Yes I call ListView's BeginUpdate()/EndUpdate() methods, I tried with =
hiding the ListView before filling it, I tried Suspend/resume Layout,. =
nothing works, I still have to wait 35 seconds.. And the only difference =
is that the form is shown before or after filling the listview !

=20

Does anybody have an idea about that problem ???

=20

Thanks for any help !

=20

Steph.

Michael J. Salamone
6/29/2005 5:42:05 AM
How many items are we talking about here? And, is there any sorting going
on? If there is sorting, any chance the sorting is working any differently?
Quick test would be to turn sorting off and see if the timing changes.

You might also put Spy++ on it and see if there is anything unusual /
unexpected.


I don't suppose you've made it a virtual listview?

--
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com


[quoted text, click to view]
Hi !

I use a ListView in a form to display Data from an SQL db.

My problem is that I can fill the listview in less than a second when I
show the form AFTER filling the listview, but I take 35 seconds if I show
the form BEFORE filling the listview !!!

Yes I call ListView's BeginUpdate()/EndUpdate() methods, I tried with
hiding the ListView before filling it, I tried Suspend/resume Layout,.
nothing works, I still have to wait 35 seconds.. And the only difference is
that the form is shown before or after filling the listview !

Does anybody have an idea about that problem ???

Thanks for any help !

Steph.


Steph.
6/30/2005 10:09:22 AM
No=20

HI,

Thanks for your interest !

There is about 2800 Items. No sorting of any kind... no virtual =
ListView...
The only difference is that the form containing the listview is shown =
before or after filling the listview... If I fill fill the listview =
before showing the form I put the 2800 items in the listview in a =
second... 35-40 second if I do that after showing the form...

Steph.


[quoted text, click to view]
How many items are we talking about here? And, is there any sorting =
going=20
on? If there is sorting, any chance the sorting is working any =
differently?=20
Quick test would be to turn sorting off and see if the timing changes.

You might also put Spy++ on it and see if there is anything unusual /=20
unexpected.


I don't suppose you've made it a virtual listview?

--=20
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com


[quoted text, click to view]
Hi !

I use a ListView in a form to display Data from an SQL db.

My problem is that I can fill the listview in less than a second when =
I=20
show the form AFTER filling the listview, but I take 35 seconds if I =
show=20
the form BEFORE filling the listview !!!

Yes I call ListView's BeginUpdate()/EndUpdate() methods, I tried with =

hiding the ListView before filling it, I tried Suspend/resume Layout,. =

nothing works, I still have to wait 35 seconds.. And the only =
difference is=20
that the form is shown before or after filling the listview !

Does anybody have an idea about that problem ???

Thanks for any help !

Steph.
Steph.
6/30/2005 11:40:02 AM
More info....

=20

The problem seems to be that it take much more time (about 40 times =
more) to add items to the ListView when its Parent property is set, or =
has been set at least once.

=20

So far, the solution to the problem is building the ListView =
programmatically, fill it, and then set its parent property. When I want =
to change the data in the Listview, I dispose it, create a new one, fill =
it then I set its parent property..

=20

Steph.


[quoted text, click to view]
How many items are we talking about here? And, is there any sorting =
going=20
on? If there is sorting, any chance the sorting is working any =
differently?=20
Quick test would be to turn sorting off and see if the timing changes.

You might also put Spy++ on it and see if there is anything unusual /=20
unexpected.


I don't suppose you've made it a virtual listview?

--=20
Michael Salamone [eMVP]
Entrek Software, Inc.
www.entrek.com


[quoted text, click to view]
Hi !

I use a ListView in a form to display Data from an SQL db.

My problem is that I can fill the listview in less than a second when =
I=20
show the form AFTER filling the listview, but I take 35 seconds if I =
show=20
the form BEFORE filling the listview !!!

Yes I call ListView's BeginUpdate()/EndUpdate() methods, I tried with =

hiding the ListView before filling it, I tried Suspend/resume Layout,. =

nothing works, I still have to wait 35 seconds.. And the only =
difference is=20
that the form is shown before or after filling the listview !

Does anybody have an idea about that problem ???

Thanks for any help !

Steph.
AddThis Social Bookmark Button