I’m working on a certain project in C# and using DataGridView in the project but encounter flickering grid and slow refresh in the DataGridView as the data increases. I usually use SuspendLayout and ResumeLayout to deal with this issue but I’m not contented with the outcome. So I look for the solution for this issue and found this post from Bitmatic showing a simple solution. I posted it here to share to you guys and for me to use these codes as reference for my future C# projects.

using System.Reflection;
//Put this class at the end of the main class or drop it anywhere in your project

public static class ExtensionMethods
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);

// Then, enable DoubleBuffered in your code


Leave a Reply

Your email address will not be published. Required fields are marked *