Here I am using FileStream object to write contents to a file.
First a FileSteam and File object is created. Using file object we will compare wether
file is exists are not.
If file exits in the disk then we will truncate it otherwise we will create new file
and allow that file for read and write using file steam object.
Sub WriteErrorReport(ByVal message As String, ByVal FileName As String)
Dim f As File
Dim fstream As FileStream
If f.Exists(FileName) Then
fstream = New FileStream(FileName, FileMode.Truncate, FileAccess.ReadWrite)
fstream = New FileStream(FileName, FileMode.Create, FileAccess.ReadWrite)
Dim sWriter As New StreamWriter(fstream)