Results 1 to 2 of 2

Thread: VB.Net DataGridView slow to load

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2016
    Posts
    2

    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!!!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width