I am a beginner with .NET environment.
I have a windows application with three textboxes and one button. When the user clicks on the button, i want all the textbox values to be serialized in an XML format to a file. 
I tried doing it this way,

```
    DialogResult dr = new DialogResult();
    private void button1_Click(object sender, EventArgs e)
    {
        AddCustomer customer = new AddCustomer();
        customer.textBox1.Text = textBox1.Text;
        customer.textBox2.Text = textBox2.Text;
        customer.textBox3.Text = textBox3.Text;
        customer.textBox4.Text = textBox4.Text;

            saveFileDialog1.InitialDirectory = @"D:";
            saveFileDialog1.Filter = "Xml Files | *.xml";
            if (saveFileDialog1.ShowDialog().Equals(DialogResult.OK))
            {

                SerializeToXML(customer);
            }            
    }

    public void SerializeToXML(AddCustomer customer)
    {

           XmlSerializer serializer = new XmlSerializer(typeof(AddCustomer));
            TextWriter textWriter = new StreamWriter(@"D:\customer.xml");
            serializer.Serialize(textWriter, customer);
            textWriter.Close();
    }

```

this returned system.invalidoperationexception was unhandled exception 

any ideas? 
Thanks,
Michael