inserire due ListBox con dentro tre Items Public Class DragAndDropSampleScreen Private Sub ListBox1_MouseDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.MouseEventArgs) _ Handles ListBox1.MouseDown Dim DragDropResult As DragDropEffects If e.Button = MouseButtons.Left Then DragDropResult = ListBox1.DoDragDrop( _ ListBox1.Items(ListBox1.SelectedIndex), _ DragDropEffects.Move Or DragDropEffects.Copy) ' If operation is a move (and not a copy), then remove then ' remove the item from the first list box. If DragDropResult = DragDropEffects.Move Then ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) End If End If End Sub Private Sub ListBox2_DragEnter(ByVal sender As Object, _ ByVal e As DragEventArgs) _ Handles ListBox2.DragOver If e.KeyState = 9 Then ' Control key e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.Move End If End Sub Private Sub ListBox2_DragDrop(ByVal sender As Object, _ ByVal e As System.Windows.Forms.DragEventArgs) _ Handles ListBox2.DragDrop ListBox2.Items.Add(e.Data.GetData(DataFormats.Text)) End Sub End Class |