DataGridView = SLOW

JumpyNET

Centurion
Joined
Apr 4, 2005
Messages
196
The new DataGridView is really slow. :( The old MSFlexGrid was super fast compared to it's new replacement. Is there a way how I could speed up the DataGridView or am I the only one experiencing this problem? Or is there an alternative?

PS: I'm using VB 2005 Express and I don't need the database features.
 
I'm using a DataGridView in a current project and I've noticed it's rather slow; fourenatly I'm only using it to help with development so it wont slow down the final release. I don't know of a good alternitive but if you find one please post for the rest of us!
 
JumpyNET said:
The new DataGridView is really slow. :( The old MSFlexGrid was super fast compared to it's new replacement. Is there a way how I could speed up the DataGridView or am I the only one experiencing this problem? Or is there an alternative?

PS: I'm using VB 2005 Express and I don't need the database features.
umm. .. are you using that bassackwards approach of loading the grid manually (like the morons at xtremeVBtalk suggest you use the flexgrids) or are you binding your collection to it?
 
Joe Mamma said:
umm. .. are you using that bassackwards approach of loading the grid manually (like the morons at xtremeVBtalk suggest you use the flexgrids) or are you binding your collection to it?

I'm not quite sure what you mean, but I'll try to answer:

1) I've simply placed a DataGridView to my form by dragging it from the toolbox.

2) I edited the columns on the designer (Properties -> Misc -> Columns)

3) And in the code I add rows like this:
Visual Basic:
DataGridView.Rows.Add("Aaaa", "Bbbbbb", "Ccccc")

4) Also the user can edit certain cells.
 
JumpyNET said:
The new DataGridView is really slow. :( The old MSFlexGrid was super fast compared to it's new replacement. Is there a way how I could speed up the DataGridView or am I the only one experiencing this problem? Or is there an alternative?

PS: I'm using VB 2005 Express and I don't need the database features.

DataGridView uses GDI+ drawing engine and for this reason it's rather slow. Wait for video cards with built-in GDI+ accelerators or start using 3rd party grid controls.
 
Yes, it draws slowly. If you watch how many records it processes, it takes as long to do the first x (that show up on the form) as it takes to add the rest out of 'scrolling range' if you will.

I tried to use the DGV.DataSource = MyCollection; however, whenever I did this it would not properly display the data. Unfourenatly I cannot run any sequal on my data so I get everything and have to manually weed out what I don't want.
 
create a class to wrap your data - MyDataClass .
declare a BindingList(MyDataClass) - MyBindingList

load MyBindingList with instances of your class
Set the DataSource of the grid to MyBindingList
 
Hello, I have the same problem too. DataGridView control is very slow when I load a lot of data. Where can I find a complete and detailed example making this:

create a class to wrap your data - MyDataClass.
declare a BindingList (MyDataClass) - MyBindingList

load MyBindingList with instances of your class
Set the DataSource of the grid to MyBindingList

In this way, i will be able to solve my problem of performance?
 
I use DGVs all the time and think they are just fine, speed wise.

Are you calling .BeginEdit() and .EndEdit() when loading lots of data records? If not, I can see why it's slow, as it's redrawing with every data row that's added.
 
Back
Top