'show the savefiledialog SaveFileDialog1.ShowDialog() 'if the user encode the file and click save If SaveFileDialog1.ShowDialog = DialogResult.OK Then 'it create a streamwriter to write in to the file Dim writer As New System.IO.StreamWriter(SaveFileDialog1.FileName, False) 'get the content of Richtextbox and write to a stream writer.Write(RichTextBox1.Text) 'close the writer 'it gets the data contains by the control and save the filename for later use. RichTextBox1.Tag = SaveFileDialog1.FileName End If