Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save Text Box to a Text File

Status
Not open for further replies.

tekrobg

Programmer
Oct 12, 2004
42
US
How would I save the contents of a multi-line text box to a text file?
 
Yes, but there is an even easier way.
If you make it a RichTextBox, rather than a regular one, you get a SaveFile method.

Mark [openup]
 
I don't think its always about what is the easiest. Why use a control which is not needed because it has a SaveFile method? It's not hard at all to work with File I/O. A multi-line TextBox contains a String, which is easy to save out to a file. I haven't looked at the RichTextBox's SaveFile method, because I do not do much with RTF. But does it only allow to save in RTF format? If so, then that does not mean "Text File" to me.
 
Actually, I need some boxes to save as a txt file and some others to be rtf files. Can someone elaborate on the rtf save method as well?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top