下面的代码在Visual Studio 2017(Win 2010 OS)上运行时,尝试将其保存到我的USB驱动器时会产生写保护媒体错误。
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("G:\Test\Test.txt", True)
file.WriteLine("TEST1")
file.Close()
MessageBox.Show("OK")
End Sub