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

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Ok I just found the answer... The problem comes from… May 11, 2026 at 12:44 pm
  • added an answer To filter out articles that don't have any content assigned… May 11, 2026 at 12:44 pm
  • added an answer There isn't any way to be sure. You can only… May 11, 2026 at 12:44 pm

Related Questions

I have been developing a C# windows form application in XP. It all works
If I have an embedded browser in a windows form, is it possible to
Is it possible to embed a windows form within another windows form? I have
Is it possible to create a form on Windows using Ruby? I have a
I have a Windows Form that takes quite a bit of time to load
I have a small application to convert several file formats, with a main windows
I'm looking for a good pattern to resolve the following circular reference in a
I have a WinForms application (I'm using VB) that can be minimized to the
I am struggling with something that I think should be easily (ish). I have

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.