Question font in streamwriter

andrews

Well-known member
Joined
Nov 22, 2011
Messages
132
Programming Experience
5-10
In my program I use filestream and streamwriter to write text to a textfile.
How can I set the text to a font that I want like courier new?
Thanks for any response
 
You can't. A text file just contains text. It's the job of an application that opens that file, e.g. Notepad, to decide what font to use to display the text. If you want to specify formatting information like font in the file itself then you have to use a format that supports that, e.g. RTF or HTML. Of course, the file is then not just a text file. If you open it in Notepad then you'll see all the metadata as well as the text. If you want the formatting honoured then the application must support that, e.g. Wordpad for RTF or a web browser for HTML.
 
Back
Top