i have a streamwriter inside of a for loop so that for each file that is moved the file name is written out to a log. it's working but it's only saving the last file that is moved to the file. am i missing something?
Code:
Dim sr As StreamWriter = New StreamWriter("C:\log.txt")
For Each item As Object In lb_M3test.Items
If item.ToString = code Then
File.Copy(f, destFile)
sr.WriteLine(DateTime.Now.ToString & " " & fileName)
sr.Close()
fileCount = fileCount + 1
End If
Next