在我的 vb.net 代码中,我使用 streamwriter 写入已作为表单输入的文件。
Dim strContents As String
Dim objReader As StreamReader
Try
objReader = New StreamReader("C:\test.txt")
strContents = objReader.ReadToEnd()
objReader.Close()
Catch Ex As Exception
End Try
Dim Contents As String
Dim bAns As Boolean = False
Dim objWriter As StreamWriter
Dim FileStream As System.IO.FileStream
Try
FileStream = New FileStream("C:\test.txt", FileMode.Open, FileAccess.ReadWrite)
objWriter = New StreamWriter("C:\test.txt")
objWriter.Write("fdgdfgdjkljljklg")
objWriter.Close()
bAns = True
Catch Ex As Exception
End Try
在某些系统中,它工作正常,但在其他一些工作站中,它显示主题中提到的错误。
是什么限制了对此处文件的访问?谁可以帮我这个事?