Try this
In this example "textBox1.Text" is the data I want to save to the file.
Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
dlg.FileName = @"YourFileName.txt";
dlg.DefaultExt = ".text";
dlg.Filter = "Text documents (.txt)|*.txt";
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
{
string fileName = dlg.FileName;
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(fileName))
{
writer.Write(textBox1.Text);
writer.Close();
}
}
and of course you will want to modify this for your needs.