大家下午好,
我正在尝试创建此代码,该代码将允许我从输入到 TextBox1.Text 的目录中创建一个新文件夹,然后打开一个对话框并选择一个 PDF,然后将文件路径放入 TextBox2(同样适用用于 TextBox3 中的单独 PDF)。
An unhandled exception of type 'System.IO.IOException' occurred in Microsoft.VisualBasic.dll
Additional information: Could not complete operation since a directory already exists in this path '\\ANVILSRV\Public\Completed Works Orders\98789'.
-
这是我在尝试完成操作时遇到的错误,它创建文件夹并且不移动任何文件。
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Dim txt As String
txt = TextBox1.Text
If My.Computer.FileSystem.DirectoryExists("\\ANVILSRV\Public\Completed Works Orders\" & txt & "") Then
MsgBox("Could not create the folder " & txt & " because it already exists.")
Else
My.Computer.FileSystem.CreateDirectory("\\ANVILSRV\Public\Completed Works Orders\" & txt & "")
My.Computer.FileSystem.MoveFile(TextBox2.Text, ("\\ANVILSRV\Public\Completed Works Orders\" & txt & ""), True)
My.Computer.FileSystem.MoveFile(TextBox3.Text, ("\\ANVILSRV\Public\Completed Works Orders\" & txt & ""), True)
End If
End Sub
非常感谢任何建议或帮助。
谢谢,
斯蒂芬