I have a sub that creates a text (work file) like this:
Code:
Public Sub CreateTextFile()
RelativePath = String.Format("\{0:yyyyMMdd_HHmmss}.txt", Date.Now)
IO.File.Create(("\\VGIWPW03-SQL3\c$\temp" & RelativePath))
End Sub
Then I have a sub that adds content to the created text file, like this:
Code:
Dim fieldterminator As Char = ControlChars.Tab
Dim rowterminator As Char = ControlChars.CrLf
Dim absolutePath As String = "\\VGIWPW03-SQL3\c$\temp" & RelativePath
Dim content As String = ticket_date _
& fieldterminator _
& job _
& fieldterminator _
& job_phase _
& fieldterminator _
& tons _
& fieldterminator _
& qty_received _
& fieldterminator _
& qty_used _
& fieldterminator _
& qty_wasted _
& fieldterminator _
& plant
IO.File.AppendAllText(absolutePath, content + Environment.NewLine)
I get an error on the Io.File>AppendAllText saying:
The process cannot access the file xxxxx because it is being used by another process..