![]() |
~[VB.NET]~ [TUT] How To Write To/Read A Text File - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Visual Basic and the .NET Framework (https://www.supportforums.net/forumdisplay.php?fid=19) +---- Thread: ~[VB.NET]~ [TUT] How To Write To/Read A Text File (/showthread.php?tid=16226) |
~[VB.NET]~ [TUT] How To Write To/Read A Text File - ThePrinCe - 02-17-2011 How to write to a text file We can StreamWriter class to write to a file. The Write method is used to write to a text file. In the StreamWriter constructor, the first parameter is the file name and second parameter is optional, boolean type. If second parameter is true, an existing file will be appended with new text. Otherwise it will erase old text and start with new text. Code: Sponsored by How to read a text file We can use StreamReader to read text files. The following code snippet reads a file and writes on the console line by line. Code: Module Module1 I Hope That Will Help ![]() |