title: Drag&Drop - differentiate between file and folder
body: <p>I'm trying to difference when the user drops a folder or a file but i get a error.</p>
  
  <p>UPDATE</p>
  
  <p>The error is: </p>
  
  <pre><code>Conversion from string "C:\Users\Administrador\Desktop\W" to type 'Long' is not valid.
  </code></pre>
  
  <p>(Notice that the path, is incomplete)</p>
  
  <p>The IDE highlights this error-line:</p>
  
  <pre><code>If ((attributes And FileAttributes.Directory) = FileAttributes.Directory) Then
  </code></pre>
  
  <p>I don't know if the problem is in the conversion or what, but if I use a msgbox before the problematic error-line, I can see how the path is correct:</p>
  
  <pre><code>MessageBox.Show(Objetos(0))
  If ((attributes And FileAttributes.Directory) = FileAttributes.Directory) Then
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/RCJGT.jpg" alt="enter image description here"></p>
  
  <p>This is the sub:</p>
  
  <pre><code>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
  </code></pre>