How to Use save file and the stream writer in VB.Net
This video takes us through the process of using the Stream Writer and the Save File Dialog
First thing you need is a Button. Click "Button" in the toolbox. Next click "Text Box" and drag it so that it has multiple lines.
Rename the button, in this case to "SaveTheText," and in the same menu we are going to rename the caption or text from "Button 1" to "Save It"
Click on Text Box and rename it, in this case to "TheText"
In the toolbox, click SaveFileDialog.
Rename SaveFileDialog to "SaveIt"
Double click the SaveIt button and under the line beginning with "Private Sub," enter the following text:
SaveIt.InitialDirectory = "C:\"
SaveIt.FileName = "Save As…"
SaveIt.Filter = "Text Files ONLY (*.txt) | *.txt"
Below this text, we are going to declare a variable by entering the following text:
Dim W As New IO.StreamWriter(SaveIt.FileName)
Click "Start Debugging." Enter some text on the first couple of lines of the text box. Click SaveIt and file dialog will pop up. Save as whatever you like (in this case ATest).
Go to C drive and click on the text document. It should have the text that you entered in the program.