Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I override Microsoft's datagridview to allow back buffering in VB.NET?

My datagridview flickers and is very slow while loading. I reflectored the datgridview from Microsoft and discovered that there is a back buffer property which is not visible from the winForm. How do I set this property?

like image 697
Michael Eakins Avatar asked Sep 03 '10 15:09

Michael Eakins


2 Answers

For some reason Microsoft put the DoubleBuffered property in there, but didn't allow us to turn it on. You can hijack the system by using SubClassing.

Public Class MyDataGridView
   Inherits DataGridView

   Sub New()  
      MyBase.New()

      Me.DoubleBuffered = True
   End Sub
End Class

In your program you can then Build it and the new class should pop up in your toolbox. Once there you are free to drag it out and use it as if it were a normal DataGridView with better drawing capabilities.

Hope this helps.

like image 178
Jimmie Clark Avatar answered Oct 26 '22 16:10

Jimmie Clark


I would use a listview, it does not have the same problems as a datagridview does.

like image 34
TheAssassin83 Avatar answered Oct 26 '22 14:10

TheAssassin83