我试图在用户删除文件夹或文件时有所不同,但出现错误。
更新
错误是:
Conversion from string "C:\Users\Administrador\Desktop\W" to type 'Long' is not valid.
(注意路径不完整)
IDE 突出显示此错误行:
If ((attributes And FileAttributes.Directory) = FileAttributes.Directory) Then
我不知道问题是在转换中还是什么,但是如果我在有问题的错误行之前使用 msgbox,我可以看到路径是正确的:
MessageBox.Show(Objetos(0))
If ((attributes And FileAttributes.Directory) = FileAttributes.Directory) Then
这是子:
Private Sub TextBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles foldertextbox.DragDrop
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
Dim Objetos As String() = e.Data.GetData(DataFormats.FileDrop)
Dim attributes = Objetos(0)
If ((attributes And FileAttributes.Directory) = FileAttributes.Directory) Then
MsgBox("it's a dir")
Else
MsgBox("it's a file")
End If
foldertextbox.Text = Objetos(0)
userSelectedFolderPath = Objetos(0)
My.Settings.folderpath = Objetos(0)
My.Settings.Save()
playerargs = Nothing
updatecheckboxes()
End If
End Sub