title: Windows Form XML Serialization Save Dialog
body: <p>im stuck with this stupid form... heres my code. It saves it where the streamwriter wants it to but when i save it where the user wants via the savedialog box is creates the XML but doesnt put anything in it! Can someone have a look as it's starting to wind me up!</p>
  
  <pre><code>void SavebuttonClick(object sender, EventArgs e)
  {
      Stream myStream ;
      SaveFileDialog savefile1 = new SaveFileDialog();
  
      savefile1.Filter = "xml files |*.xml"  ;
      savefile1.FilterIndex = 2 ;
      savefile1.RestoreDirectory = true ;
  
      if(savefile1.ShowDialog() == DialogResult.OK)
      {
          if((myStream = savefile1.OpenFile()) != null)
          {
              Values v = new Values();
              v.task1_name = this.task1_name.Text;
              v.task1_desc = this.task1_desc.Text;
              v.task1_date = this.task1_date.Value;
              v.task1_time = this.task1_time.Value;
              SaveValues(v);
          }
          myStream.Close();   
      }
  }
  </code></pre>
  
  <p>This is the streamwriter...         </p>
  
  <pre><code>public void SaveValues(Values v)
  {
      XmlSerializer serializer = new XmlSerializer(typeof(Values));
      using(TextWriter textWriter = new StreamWriter(@"E:\TheFileYouWantToStore.xml"))
      {
          serializer.Serialize(textWriter, v);
      }
  ...
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <pre><code>public class Values 
  {
  public string task1_name { get; set;}
  public string task1_desc { get; set;}
  public DateTime task1_date { get; set;}
  public DateTime task1_time { get; set;}
  }
  </code></pre>
  
  <p>I presume this is the code you meant, im fairly new to coding though mate :(</p>