Here is the simple snippet of code in C# that can be used for getting the save dialog box.
Code:
SaveFileDialog td;
public Page()
{
InitializeComponent();
td = new SaveFileDialog();
td.Filter = "Text Files | *.txt";
td.DefaultExt = "txt";
}
private void SaveButton_Click(object sender, RoutedEventArgs e)
{
bool? result = td.ShowDialog();
if (result == true)
{
System.IO.Stream fs = td.OpenFile();
System.IO.StreamWriter sw = new System.IO.StreamWriter(fs);
sw.WriteLine("This can be used for writing something.");
sw.Flush();
sw.Close();
}
}
I hope that this will help you.
Bookmarks