write to text file vb.net vbnet create and write on file write to text file vb.net

The solution for “write to text file vb.net vbnet create and write on file write to text file vb.net” can be found here. The following code will assist you in solving the problem.

‘streamwriter allows us to write to a file
Dim file As System.IO.StreamWriter

file = My.Computer.FileSystem.OpenTextFileWriter([FileName], True)
file.WriteLine([text])
file.Close()Dim strFile As String = “yourfile.txt”
Dim fileExists As Boolean = File.Exists(strFile)
Using sw As New StreamWriter(File.Open(strFile, FileMode.OpenOrCreate))
sw.WriteLine( _
IIf(fileExists, _
“Error Message in Occured at– ” & DateTime.Now, _
“Start Error Log for today”))
End UsingDim [FileVar] As String = Application.StartupPath & “/[FileName]”

FileOpen(1, [FileVar], OpenMode.Append)
PrintLine(1, text)
FileClose(1)

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts