|
-
Nov 24th, 2009, 06:26 PM
#1
Thread Starter
Lively Member
save textbox to disk
Hi I am wondering how to save a textbox contents to disk?? Using the MSDN help I was able to come up with this code so far. I have a menu strip item labled "save as." when I click it the prompt to allow you to pick a location to save comes up and it will save a text file to the selected location but the .txt file is blank. How do I set this code so that it knows to save the contents of the textbox. Thanks!!
Dim saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.Filter = "Text|*.txt"
saveFileDialog1.Title = "Save File As"
saveFileDialog1.ShowDialog()
If saveFileDialog1.FileName <> "" Then
Dim fs As System.IO.FileStream = CType _
(saveFileDialog1.OpenFile(), System.IO.FileStream)
fs.Close()
End If
-
Nov 24th, 2009, 06:50 PM
#2
Re: save textbox to disk
I believe you need to use a StreamWriter to write it to a TextBox. MSDN should be able to provide an adequate example.
Also, it's better if you place your code in Code or VBCode[/b] blocks.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|