Question

I'm using a custom cs file from here (http://www.codeproject.com/Articles/86503/Saving-the-state-serializing-a-Windows-Form?msg=4819352#xx4819352xx) to serialize my windows form into an XML file.

I'm afraid I might not be using the correct events in order to trigger the serialization because only some of the form data is being serialized.

    private void Form1_Load(object sender, EventArgs e)
    {
        try
        {
            FormSerialisor.Deserialise(this, Application.StartupPath + @"\serialise.xml");
        }

        catch (InvalidCastException theError)
        {

        }
    }

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        FormSerialisor.Serialise(this, Application.StartupPath + @"\serialise.xml");
    }

Here's a screen shot:

https://i.stack.imgur.com/8xRKH.jpg

I've used coding practices to prevent duplicate object names by leaving the default names intact and just changing the "text" field or adding labels. My only guess is that the program is quitting before it finishes serializing the data.

Is this the correct handler to be calling this from?

Was it helpful?

Solution

If I am not mistaking you have NumericUpDown control which is not handled by the FormSerialisor. You need to make sure that all the controls that you are using are handled in the FormSerialisor.

I hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top