-
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
-
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.