Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 138959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:20:58+00:00 2026-05-11T07:20:58+00:00

I have a windows form. It contains several datagridviews on it. At some point,

  • 0

I have a windows form. It contains several datagridviews on it. At some point, the user can press a button which updates the datagridviews. When they do, they can usually sit and watch the datagridview redraw itself, one row at a time. I’d like for the control to not paint until its ‘done’, that is, I’d like a way to tell the control to

Control.SuspendRedraw() this.doStuff() this.doOtherStuff() this.doSomeReallyCoolStuff() Control.ResumeRedaw() 

I’ve seen the SuspendLayout / ResumeLayout functions, but they do nothing (they seem to be more related to resizing/moving controls, not just editting their datavalues?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:20:59+00:00Added an answer on May 11, 2026 at 7:20 am

    There are a couple of things that you can try:

    First, try setting the DoubleBuffer property of the DataGridView to true. This is the property on the actual DataGridView instance, not the Form. It’s a protected property, so you’ll have to sub-class your grid to set it.

    class CustomDataGridView: DataGridView {     public CustomDataGridView()     {         DoubleBuffered = true;     }  } 

    I’ve seen a lot of small draw updates take a while with the DataGridView on some video cards, and this may solve your problem by batching them up before they are sent off for display.


    Another thing you can try is the Win32 message WM_SETREDRAW

    // ... this would be defined in some reasonable location ...  [DllImport('user32.dll', CharSet = CharSet.Auto, SetLastError = false)] static extern IntPtr SendMessage(HandleRef hWnd, Int32 Msg, IntPtr wParam, IntPtr lParam);  static void EnableRepaint(HandleRef handle, bool enable) {     const int WM_SETREDRAW = 0x000B;     SendMessage(handle, WM_SETREDRAW, new IntPtr(enable ? 1 : 0), IntPtr.Zero); } 

    Elsewhere in your code you’d have

    HandleRef gh = new HandleRef(this.Grid, this.Grid.Handle); EnableRepaint(gh, false); try {     this.doStuff();     this.doOtherStuff();     this.doSomeReallyCoolStuff(); } finally {     EnableRepaint(gh, true);     this.Grid.Invalidate(); // we need at least one repaint to happen... } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a windows form which contains a user control. This user control has
I have a web form that contains several inputs, some of which are positioned
I have a c# windows form app which contains several forms. Generally, for example,
I have a form MainForm which is a Windows Forms form that contains many
I have a jQuery Model windows which contains a form. On creating of the
For my C# Windows Form Application, I have created a flowlayoutpanel that contains several
I have a Windows form which contains a grid of PictureBox controls. I want
i have a windows form that contains a bunch of textboxes. I need a
I have a C# Windows Form application that contains a menu with this event:
I have a windows form app, and a class which is called Game. Let's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.