Increase performance of a databound DataGridView

by Mikael Henriksson 27. January 2009 18:59

This was a hard nut to crack. I was just about to pull out my railgun and frag that stupid control for good. Though as soon as I got my hands on the railgun I got tele-fragged by the creators. After 2 days of searching on the internet I actually found something useful on MSDN. Over at http://msdn.microsoft.com/en-us/library/ha5xt0d9.aspx they say that databound grids can be slow in a few scenarios. The one that effected me though was that I had Autosize on both rows and columns. When I set AutosizeColumns = AllHeaders and AutosizeRows = None the problems were gone.

It got me thinking though, all things like resizing enabled should affect performance. I won’t think more on it. I am happy to have gone from 5-10 seconds loading 80 rows to 300 milliseconds loading 11000 rows. :)

Tags:

Windows Forms

blog comments powered by Disqus

About the author

Life architect specialized in programming