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 Controls / January 2007

Tip: Looking for answers? Try searching our database.

Using Datagridview with virtual mode and large amounts of data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Al Christoph - 27 Jan 2007 02:23 GMT
1. I apologize for the empty posting with a similar title.
2. I've long since mastered virtual mode in datagridview for doing lots of
things besides what it was designed for i.e. handling large amounts of data.
I have a couple of very clever data entry systems for engineers that make it
look more like a fancy spreadsheet than anything else.

3. So I finally get around to using it for large amounts of data an I am
appalled, just appalled. Response time for data load was horrible. I squeezed
every bit of slop out of the data input and finally pin pointed the culprit
was setting the rowcount.

Since I was doing what the MSDN article on this situation suggested I was
scrating my head. Here follows for the broader community what I posted on the
bottom of that article.

Implementing Virtual Mode with Just-In-Time Data Loading in the Windows
Forms DataGridView Control  
http://msdn2.microsoft.com/en-us/library/ms171624.as

I was not dealing with a large number of rows - about 1000 - but it was
taking way too long to load the grid. The data read in almost
instantaneously; setting grid.rowcount was killing me. (When I set it
arbitrarily to 10000, setting the rowcount never did complete within the
amount of time I was willing to wait, no less under the 3 second rule.)

The cure was simple and not mentioned above as near as I can tell.  It is
essential that grid.CausesValidation = False
be off at least for the time it takes to set rowcount. Makes all the
difference in the world in response time. (I've seen suggestions in other
articles that the number of rows in the grid be limited to a smaill number
but that leads to very intersting navigation problems.)

I have a completely different app where the datagridview is being used as a
psuedo-spreadsheet rather than as a database viewer. The spreadsheet has the
ability to show / hide inactive rows. Toggling this mode was painfully slow
when shrinking - you could wat the scroll change size. Not enough time for a
coffee break, but certainly enough for a good swig. Turned off validation and
problem stuck around. What's the difference - in both cases the grid is not
bound to anything and virtual mode feeds all the data. However, in the first
(fast) case the grid doesn't explicity store anything whatsoever. In the
second (slow) case I am using the grid.rows to store the "data". In
retrospect that was probably a mistake. Ah well, the joys of consulting.
Fixing the speed was on the todo list for the next release.

Signature

Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail for Vista.

Linda Liu [MSFT] - 29 Jan 2007 09:29 GMT
Hi AI,

I am sorry that I may not understand your question exactly.

Based on my understanding, you performed a test based on the sample code in
the MSDN article 'Implementing Virtual Mode with Just-In-Time Data Loading
in the Windows Forms DataGridView Control', only to find that response time
for data load was horrible. You also found a workaround for this problem,
i.e. set the CausesValidation = false when it takes to set the
DataGridView's RowCount property. If I'm off base, please feel free to let
me know.

In theory, it shouldn't be slow to set the RowCount property of a
DataGridView. And the get procedure of the RowCount property within the
DataRetriever class should not take much time either. I think the problem
may be related to the actual code in your project.

>  What's the difference - in both cases the grid is not bound to anything
and virtual mode feeds all the data.

I'm sorry that I couldn't understand what you mean in the above sentence.
Could you please explain more?

If possible, could you please send me your sample project that could just
reproduce the problem? To get my actual email address, remove 'online' from
my displayed email address.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Al Christoph - 29 Jan 2007 14:18 GMT
I goofed. I changed two things at once and jumped on the one (causes
validation) that made the most sense.

What does it is either setting the rowheader to be visible or certain values
of the selection mode!

I am using Vista RTM with VSTS 2005 W/O SP1. (I haven't figured out how to
get SP1 to install on this Vista box:-((((

I have spent some time trying to build a test project but as much as I
decorate the grid to look like the one that goofs up, I haven't been able to
reproduce the problem.

If you have access to Vista, I'll be happy to zip up the actual project and
let you try.

In the mean time I will plug away at trying to make the test case fail.

Signature

Regards,
Al Christoph
Senior Consultant
Three Bears Software, LLC
just right software @ just right prices @ 3bears.biz
Microsoft Certified Partner (ISV)
Coming soon: Windows Mail for Vista.

> Hi AI,
>
[quoted text clipped - 46 lines]
>  
> This posting is provided "AS IS" with no warranties, and confers no rights.
Linda Liu [MSFT] - 31 Jan 2007 08:36 GMT
Hi Al,

Thank you for your prompt reply.

> I am using Vista RTM with VSTS 2005 W/O SP1. (I haven't figured out how to
get SP1 to install on this Vista box:-((((

You may visit the following link to get VS2005 SP1.

'Visual Studio 2005 Service Pack 1 (SP1)'
http://msdn2.microsoft.com/en-us/vstudio/bb265237.aspx

Since you're using Vista, you'd better install 'Visual Studio 2005 Service
Pack 1 Upate for Windows Vista Beta' to get VS2005 to work better with
Vista. You could get it from the above link.

For simplification, I think you'd better create a simple sample project
that could just repoduce the problem. If you have difficulties in creating
such a sample project, you may send me your actual project and I promise to
delete it from my machine after I finish investigation.

To get my actual email address, remove 'online' from my displayed email
address.

Sincerely,
Linda Liu
Microsoft Online Community Support
Tim Van Wassenhove - 29 Jan 2007 16:43 GMT
Al Christoph schreef:
> 3. So I finally get around to using it for large amounts of data an I am
> appalled, just appalled. Response time for data load was horrible. I squeezed
> every bit of slop out of the data input and finally pin pointed the culprit
> was setting the rowcount.  

Setting ColumnHeadersHeightSize (and it's brother for Row) to
DisableResizing resulted in drastic improvements for me...

Signature

Tim Van Wassenhove <url:http://www.timvw.be/>


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.