vis781
Well-known member
Drag Drop Issue. [Resolved]
Hi all, was wondering if someone could look over the folloeing code for me. All i'm trying to do is drag one listbox item and drag it into another...
listbox i'm dragging from....
check the dataformat in the dragged item...
drop it....
When i drag the first item it's fine. But every item i try to drag after that is the same as the first one.
Cheers.
Hi all, was wondering if someone could look over the folloeing code for me. All i'm trying to do is drag one listbox item and drag it into another...
listbox i'm dragging from....
VB.NET:
Private Sub DropBox_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DropBox.MouseDown
Me.DropBox.DoDragDrop(CType(Me.DropBox.SelectedItem, String), DragDropEffects.Copy)
End Sub
check the dataformat in the dragged item...
VB.NET:
Private Sub CurrentBox_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles CurrentBox.DragEnter
If e.Data.GetDataPresent(GetType(String)) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
drop it....
VB.NET:
Private Sub CurrentBox_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles CurrentBox.DragDrop
Me.CurrentBox.Items.Add(e.Data.GetData(GetType(String)))
End Sub
When i drag the first item it's fine. But every item i try to drag after that is the same as the first one.
Cheers.
Last edited: