Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drag&drop between objects
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00867409
Message ID:
00867445
Views:
21
You need to set the AllowDrop property of the PictureBox to True. But this property doesn't show into the properties dialog. The simplest workaround is to set them into the Load event:
PictureBox1.AllowDrop = True
My February column in the UTMag (www.utmag.com) is on this topic!


>Hi all,
>I'm trying to implement a simple Drag&Drop operation between two PictureBox on the same form (VB.NET), but it seems that the DragDrop event on the Destination object doesn't fire.
>If I put a messagebox in the DragEnter, DragLeave, ecc. I can see that those events fire, but the DragDrop no!
>Here's some of the code
>
>Private Sub PictureBoxSource_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBoxSource.MouseMove
>   If e.Button = MouseButtons.Left Then
>      Dim dropEffect As DragDropEffects = sender.DoDragDrop(sender, DragDropEffects.Copy)
>      MessageBox.Show("End drag! " + dropEffect.ToString)
>   End If
>End Sub
>
>Private Sub PictureBoxDest_DragOver(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBoxDest.DragOver
>   e.Effect = DragDropEffects.Copy
>End Sub
>
>Private Sub PictureBoxDest_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBoxDest.DragDrop
>   MessageBox.Show("DragDrop ")
>End Sub
>
>
>Perhaps I am not understanding how to do Drag&Drop operations, any suggestions?
>
>Thanks, Franco
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform