This video takes us through the process of using the Stream Writer and the Save File Dialog
Step 1
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.
Step 2
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"
Step 3
Click on Text Box and rename it, in this case to "TheText"
Step 4
In the toolbox, click SaveFileDialog.
Step 5
Rename SaveFileDialog to "SaveIt"
Step 6
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"
SaveIt.ShowDialog()
Step 7
Below this text, we are going to declare a variable by entering the following text:
Dim W As New IO.StreamWriter(SaveIt.FileName)
W.Write(TheText.Text)
W.Close()
Step 8
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).
Step 9
Go to C drive and click on the text document. It should have the text that you entered in the program.
Want to master Microsoft Excel and take your work-from-home job prospects to the next level? Jump-start your career with our Premium A-to-Z Microsoft Excel Training Bundle from the new Gadget Hacks Shop and get lifetime access to more than 40 hours of Basic to Advanced instruction on functions, formula, tools, and more.
Other worthwhile deals to check out:
- 97% off The Ultimate 2021 White Hat Hacker Certification Bundle
- 98% off The 2021 Accounting Mastery Bootcamp Bundle
- 99% off The 2021 All-in-One Data Scientist Mega Bundle
- 59% off XSplit VCam: Lifetime Subscription (Windows)
- 98% off The 2021 Premium Learn To Code Certification Bundle
- 62% off MindMaster Mind Mapping Software: Perpetual License
- 41% off NetSpot Home Wi-Fi Analyzer: Lifetime Upgrades
Be the First to Comment
Share Your Thoughts