Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Datagridview is faster at the beginning than at the end?

11 views
Skip to first unread message

intars

unread,
Nov 25, 2009, 10:33:29 AM11/25/09
to
I am trying to create datagridview connected to sqlserver.
But it seems that even in simple datagridview cannot handle quickly millions
of rows. And also scrolled to upper rows datagridview updates noticably
faster, that scrolled down to last row.

The effect can be seen:

Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.
EventArgs) Handles Me.Load
DataGridView1.VirtualMode = True
DataGridView1.RowCount = 10000000
DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
End Sub

Private Sub DataGridView1_CellValueNeeded(ByVal sender As Object, ByVal e
As System.Windows.Forms.DataGridViewCellValueEventArgs) Handles DataGridView1.
CellValueNeeded
e.Value = 1
End Sub
End Class

''form contains datagridview with 3 columns


Is there some workaround?

John Bundy

unread,
Nov 29, 2009, 2:51:01 PM11/29/09
to
There is a simple workaround, don't put a million records in a datagridview.
This has nothing to do with the program, you are trying to display a million
rows. Datagridviews are for displaying data, there cant be any reason to
display that much other than you just want to see it. Filter it or let the
user filter it to find what they are wanting, before you load it ask some
questions to narrow it down.
The first question to ask is what they are looking for, once they find it,
what then, and when you get down to something manageable then display it.
If you simply must show it, get a bigger computer, the hardware is your
limitation. I have a 64 bit quad core server with 32 gigs of ram and it takes
that thing a while to display, a desktop will be MUCH slower.
--
-John http://www.jmbundy.blogspot.com/
Please rate when your question is answered to help us and others know what
is helpful.


"intars" wrote:

> .
>

intars via DotNetMonster.com

unread,
Nov 30, 2009, 3:29:21 AM11/30/09
to
Well obviously it is not a memory issue, because on upper rows datagridview
works fast, but on lower rows its response is slower and slower. And it is
possible to go back to upper rows and it works fast again.

Also it seems that populating rows with data works fast. But slowness is
caused by change of current row.

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/winform-data-binding/200911/1

John Bundy

unread,
Nov 30, 2009, 8:51:01 AM11/30/09
to
Haven't tested these, but it looks like they did:
http://www.developerdotstar.com/community/node/706

--
-John http://www.jmbundy.blogspot.com/
Please rate when your question is answered to help us and others know what
is helpful.


"intars via DotNetMonster.com" wrote:

> .
>

intars via DotNetMonster.com

unread,
Nov 30, 2009, 9:42:37 AM11/30/09
to
I tried suggestions on given link.
I didn't see any improvements.
Actually I I've already tried to set to false almost everything that has
something with "auto" :)


John Bundy wrote:
>Haven't tested these, but it looks like they did:
>http://www.developerdotstar.com/community/node/706

>> Well obviously it is not a memory issue, because on upper rows datagridview
>> works fast, but on lower rows its response is slower and slower. And it is
>> possible to go back to upper rows and it works fast again.
>>
>> Also it seems that populating rows with data works fast. But slowness is
>> caused by change of current row.

--
Message posted via http://www.dotnetmonster.com

intars via DotNetMonster.com

unread,
Nov 30, 2009, 9:50:07 AM11/30/09
to
But didn't try other framework e.g. NET 1.1


John Bundy wrote:
>Haven't tested these, but it looks like they did:
>http://www.developerdotstar.com/community/node/706

0 new messages