To write the contents of a string to a file:
Dim toWrite As String = "This will be written to the file."
System.IO.File.WriteAllText("filename.txt", toWrite)
WriteAllText will open the specified file, write the data, and then close the file. If the target file exists, it is ...