这是运行此脚本时收到的错误消息。它是通过电子邮件发送txt文件的函数的一部分。有人可以帮忙吗?
其他信息:该进程无法访问文件' C:\ Users \ Alex \ Documents \ Keys \ log.txt'因为它正被另一个进程使用。
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
Dim filePath As String = String.Format("C:\Users\Alex\Documents\Keys\log.txt")
Dim fileExists As Boolean = File.Exists(filePath)
Using writer As New StreamWriter(filePath, True)
If Not fileExists Then
writer.WriteLine("Start Error Log for today")
End If
writer.WriteLine(RichTextBox1.Text)
RichTextBox1.Text = ("")
writer.Close()
End Using
End Sub