2014-09-25 228 views
-1

創建一個新的csv文件我想創建一個新的csv文件,每當我按下一個按鈕並用日期和時間戳名稱保存它。按下按鈕

到目前爲止,這是我的代碼,但我只能添加或覆蓋,該文件被創建一次:(

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click 

Dim csvFile As String = "C:\" & FindDate("", 2) & Time.Replace(":", "") &".csv" 

Dim outFile As System.IO.StreamWriter = New StreamWriter(csvFile, False) 

outFile.WriteLine("hello") 

outFile.Close() 

End Sub 

回答

0

「C:\」 & DateTime.Now.ToString( 「YYYYMMDDHHMMSS」)