我正在尝试为以下代码创建CSV文件。当我最初运行代码时,它通常会创建csv文件。对于相同的代码,它不会创建CSV文件。让我知道什么是
If counter = 1 Then
counter = 0
Dim headerText = ""
Dim csvFile As String = IO.Path.Combine(My.Application.Info.DirectoryPath, "test.csv")
If Not IO.File.Exists((csvFile)) Then
headerText = "Date,TIME ,Current, "
End If
Using outFile = My.Computer.FileSystem.OpenTextFileWriter(csvFile, True)
If headerText.Length > 0 Then
outFile.WriteLine(headerText)
End If
Dim date1 As String = "24-10-2014"
Dim time1 As String = CStr(TimeOfDay())
Dim Current As String = CStr(distance)
'Dim x As String = CStr(CDbl(date1 + "," + time1 + ",") + distance)
Dim x As String = date1
outFile.Write(x)
End Using
End If