Sunday, November 14, 2010

How can i save a text file in vb 2008 without a file existing to save to?

i am making a program that when the computer is shutting down, the program will save a .txt file to C:\Logs with the computer time. But a file has to exist to save to without using save file dialog. How do i get past this?How can i save a text file in vb 2008 without a file existing to save to?
I usually use the System.IO.StreamWriter class to write text files.



Imports System.IO

...

Using timeLogger As New StreamWriter(';C:\Logs\TimeLog.txt';, False)

timeLogger.WriteLine(Date.Now.ToString鈥?br>
timeLogger.Close()

End Using

No comments:

Post a Comment