I am using VB2010 Pro
I am using a borderless form.
I have the AllowDrop property set to "True"
Here is the code I am using. It's common code.
Private Sub CreateIcon(ByVal bitmapName As String)
Try
Dim fi As New System.IO.FileInfo(bitmapName)
Dim bmp As New Bitmap(fi.FullName)
Dim sw As System.IO.StreamWriter = System.IO.File.CreateText(fi.FullName.Replace(fi.Extension, ".ico"))
Icon.FromHandle(bmp.GetHicon).Save(sw.BaseStream)
sw.Close()
Catch ex As Exception
System.Diagnostics.Debug.WriteLine(ex)
End Try
End Sub
Private Sub frmAppPanel_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
Dim arr As Array = DirectCast(e.Data.GetData(DataFormats.FileDrop), Array)
For i As Integer = 0 To arr.Length - 1
CreateIcon(Convert.ToString(arr.GetValue(i)))
Next
End Sub
Private Sub frmAppPanel_DragEnter(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
I am dragging Images from the Pictures folder onto the form
and I keep getting the ( NO SMOKING SIGN ) cursor when I goto
drop all the images wether it is 1 or 21.
I have used basically every piece of code I could find for the
drag and drop operation and none work.
My question is "Does anyone know how todo this?" If so, could
you point me in the right direction?.