How do i write data to text file in VB.NET ?
i want to write data to text file in vb.net.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rohatash KumarPosted Jun 3, 2011, 7:14 AM
The below code define how to write data in text file in vb.net
Module Module1
Sub Main()
Dim fileName As String = "C:\rohatash\McTextFile.txt"
Using reader As New System.IO.StreamReader(fileName)
While Not reader.ReadLine() Is Nothing
Console.WriteLine(reader.ReadLine())
End While
End Using
Try
Using writer As New System.IO.StreamWriter(fileName, True)
writer.WriteLine("New text")
writer.WriteLine("New text line goes here")
End Using
Catch ex As Exception
End Try
Console.ReadKey()
End Sub
End ModulevijayPosted May 31, 2011, 6:08 AM
http://vbdotnetaddict.blogspot.com/2011/03/how-to-create-log-filetxt-in-vbnet.html
VulpesPosted May 11, 2011, 5:38 AM