Private Sub PictureBox_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragDrop, PictureBox2.DragDrop 'Check if data is present If Not e.Data.GetDataPresent(DataFormats.Bitmap) Then Exit Sub 'Determine if it is a copy or move operation If CBool(e.KeyState And 8) Then ' Display the copy cursor. e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.Move End If 'Get a reference to the current textbox control Dim ctlCurrent As PictureBox = DirectCast(sender, PictureBox) 'Paste the image to drop ctlCurrent.Image = DirectCast(e.Data.GetData(DataFormats.Bitmap), Image) End Sub Private Sub PictureBox_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragEnter, PictureBox2.DragEnter 'Check the format of the data being dropped. If e.Data.GetDataPresent(DataFormats.Bitmap) Then 'Checks if the CTRL key is held If CBool(e.KeyState And 8) Then 'Display the copy cursor. e.Effect = e.AllowedEffect And DragDropEffects.Copy Else 'Display the move cursor e.Effect = e.AllowedEffect And DragDropEffects.Move End If Else 'Display the no-drop cursor. e.Effect = DragDropEffects.None End If End Sub Private Sub PictureBox_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove, PictureBox2.MouseMove 'Nothing to do if no mouse button is pressed. If e.Button = 0 Then Exit Sub 'Get a reference to the current PictureBox control Dim ctlCurrent As PictureBox = DirectCast(sender, PictureBox) 'If we get here, it means that the mouse is ' being dragged outside the control. 'Store the image to be drag into a DataObject object Dim objDO As New DataObject objDO.SetData(DataFormats.Bitmap, ctlCurrent.Image) 'Starts the drag operation Dim effect As DragDropEffects = DragDropEffects.Copy Or DragDropEffects.Move effect = ctlCurrent.DoDragDrop(objDO, effect) 'This portion of code will run after the code has been dropped. 'Delete the image if it was a move. If effect = DragDropEffects.Move Then ctlCurrent.Image = Nothing End If End Sub #End Region Private Sub Form1_Load( _ ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load 'Set here because this property doesn't appear into the properties dialog PictureBox1.AllowDrop = True PictureBox2.AllowDrop = True End Sub>Thanks Eric, but, I forgot to mention in my previous post, I set this property.
PictureBox1.AllowDrop = True
>>>>>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 >>>>>>