Dim writeFile As System.IO.TextWriter
Dim filePath As String
Dim filename As String = "EPH" + DateTime.Now.Day.ToString("00") + DateTime.Now.Month.ToString("00") + DateTime.Now.Year.ToString() + ".txt"
filePath = "D:\Exported Report\" + filename
writeFile = New _
StreamWriter(filePath)
Try
text = "xxx"
writeFile.WriteLine(text)
writeFile.Flush()
writeFile.Close()
writeFile = Nothing
Catch ex As Exception
writeFile.Close()
writeFile = Nothing
End Try