Click here to Skip to main content
15,885,366 members
Articles / Programming Languages / C#

Saving the state (serializing) a Windows Form

Rate me:
Please Sign up or sign in to vote.
4.40/5 (41 votes)
13 Jun 2010CPOL14 min read 158.9K   8.3K   76  
Describes how to save the state of all controls on a form, and restore them at a later time
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace SerialisationTest {
  static class Program {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      Application.Run(new Main());
    }
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Pixata Ltd
United Kingdom United Kingdom
I've been writing programs for about thirty years now, having started out on an IBM System/32, and moving my way through various IBM mainframes, then onto SGI Unix machines, and ending up (so far) with Windows and the .NET framework.

Favourite programming language is C#, favourite music is classical (the two go well together).

Comments and Discussions