VB.Net DataGridView slow to load
This is a solution for anyone who is interested.
I use VS2019 and standard SQL on my laptop. I have created a small app with a DGV of 300 rows and 270 columns (81,000 cells).
At load I read from a DB table and populate the dgv, and it takes quite a few seconds (no user would pay for this kind of performance, but it's a little thing I do at home)
I have tried to index the table but that did nothing, so I was left with the rendering being the issue.
I sorted it out by making the dgv visible=false at design time.
I then run the program, do the data load to the dgv, and finally, at the very end of the Load sub I make visible=true.
It now populates in less than 2 seconds! A win!!!
Re: VB.Net DataGridView slow to load
How are you populating it? If you're doing it one row at a time then I'm not surprised it was slow. Ideally, you would populate a list of some sort and bind that via the DataSource property. If you do that then it will probably load quickly without the workaround, because it won't try to redraw after every row. You might still get slightly better performance by hiding it though