ExtensionMethod.NET Home of 846 C#, Visual Basic, F# and Javascript extension methods

How to show data more smoothly in DataGridView (simple)?

In C# programming with winform, when you display data on DataGridView with a large number of rows and columns, every time you drag the row, scroll the column, the DataGridView will be jerky and laggy. How can we make it show data more smoothly? There are many ways and of course Basiap will guide you in the simplest way. One hit applies to all of your DataGridView. More informations at: http://basiap.com/thong-tin/kien-thuc-cong-nghe/lap-trinh-c-tang-hieu-suat-load-du-lieu-cua-datagridview-len-10-lan


using System.Reflection;

public static void DoubleBuffered(this DataGridView dgv, bool setting)
    Type dgvType = dgv.GetType();
    PropertyInfo pi = dgvType.GetProperty("DoubleBuffered",
          BindingFlags.Instance | BindingFlags.NonPublic);
    pi.SetValue(dgv, setting, null);



Author: Basiap.com

Submitted on: 3 jul 2021

Language: csharp

Type: System.Windows.Forms.DataGridView

Views: 260