DataGridView blinks while refreshing using Windows C#

Total Post:19

Points:133
C# 
C#
 5366  View(s)
Ratings:
Rate this:
After refreshing datagridview, I lost focus on selected cells and random text blinks, Why? Please help me out!

My code: -

If I am trying to refresh various data in my datagridview, I lost my focus on selected cells and random text blinks. Why this happens? In other apps I don't see this problem, so I can fix this, but how? I refresh data by this

            SBind.DataSource = DTable;

            SBind.ResetBindings(false);

  1. Post:28

    Points:196
    Re: DataGridView blinks while refreshing using Windows C#

    You can Try this:

    dataGridView1.SuspendLayout()

    SBind.DataSource = DTable;

    SBind.ResetBindings(false);

    dataGridView1.ResumeLayout(true);

    You can also try enabling the DoubleBuffered of your grid like this:

    typeof(Control).GetProperty("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(dataGridView1, true, null);

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!