---
title: "SaveFileDialog in CSharp .NET"  
description: "Here I am going to  demonstrate how to use  SaveFileDialog in C#.Net.ExampleCreating stream for  writing file   Stream str;    //creating object of Sa"  
author: "Anonymous User"  
published: 2010-07-18  
updated: 2020-07-11  
canonical: https://www.mindstick.com/articles/89/savefiledialog-in-csharp-dot-net  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# SaveFileDialog in CSharp .NET

Here I am going to demonstrate how to use SaveFileDialog in C#.Net.

![SaveFileDialog in CSharp .NET](https://www.mindstick.com/mindstickarticle/ec7187aa-4fc4-42be-b78a-9ce520be75a5/images/07543074-4774-4ae8-b833-26e0588c643f.png)

**Example**

Creating stream for writing file

```
   Stream str;  //creating object of SaveFileDialog   SaveFileDialog saveFileDialog1 = new SaveFileDialog();  //creating filter to saveFileDialog  saveFileDialog1.Filter = "Text File|*.txt";  //checking whether saved button is pressed or not.  if (saveFileDialog1.ShowDialog() == DialogResult.OK)     {        if ((str = saveFileDialog1.OpenFile()) != null)         {         //creating stream writer.          StreamWriter wText = new StreamWriter(str);             //writing text to file.            wText.Write(" your text");             //closing stream.              str.Close();          }     MessageBox.Show("FileSaved!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
```

---

Original Source: https://www.mindstick.com/articles/89/savefiledialog-in-csharp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
