How do I disable updating a form in Windows Forms?

During a complicated update I might prefer to display all the changes at once. I know there is a method that allows me to do this, but what is it?


I think this.SuspendLayout() & ResumeLayout() should do it

I don't find SuspendLayout() and ResumeLayout() do what you are asking for. LockWindowsUpdate() mentioned by moobaa does the trick. However, LockWindowUpdate only works for one window at a time.

You can also try this:

using System;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Runtime.InteropServices;

public partial class Form1 : Form
    public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
    private const int WM_SETREDRAW = 11; 

    public Form1()

    private void button1_Click(object sender, EventArgs e)
      SendMessage(this.Handle, WM_SETREDRAW, false, 0);

      // Do your thingies here
      SendMessage(this.Handle, WM_SETREDRAW, true, 0);


You can use the old Win32 LockWindowUpdate function:

private static extern long LockWindowUpdate(long Handle);

try {
    // Lock Window...
    // Perform your painting / updates...
finally {
    // Release the lock...

Most complex third-party Windows Forms components have BeginUpdate and EndUpdate methods or similar, to perform a batch of updates and then drawing the control. At the form level, there is no such a thing, but you could be interested by enabling Double buffering.

You can use SuspendLayout and ResumeLayout methods in the form or controls while updating properties. If you're binding data to controls you can use BeginUpdate and EndUpdate methods.

SuspendLayout will help performance if the updates involve changes to controls and layout: MSDN

Need Your Help

Java calendar applet issue with first day of the month

java calendar applet

So everything is done but I have one problem: my calendar doesn't keep it's starting date as we go through the week.

Combine mysql records from a set date into a timetable?

php html mysql timetable

I am trying to make a small appointment timetable for 5 people for daily use. The only problem I am having now is to get the timetable display all appointment for the same staff into one column. I ...