Below is a quick and dirty way to write out a string to a text file using vb.net, as you will see from the code it doesn’t take into account any exceptions that may occur.
Sub WriteTextFile(sText As String, sFileName As String, bAppendToFile As Boolean,
bDeleteFileIfExists As Boolean)
If bDeleteFileIfExists = True And System.IO.File.Exists(sFileName) Then
Dim objWriter As New System.IO.StreamWriter(sFileName, bAppendToFile)