Drag items from ListBox to ListView
  • How do you drag items from ListBox to ListView in VB.NET?


    Thank You
  • 2 Comments sorted by
  • In VB.NET code
    1. I hope it is very useful for u 
    2. Form1_Load
    3.         ListBox1.Items.Add("NewDelhi")
    4.         ListBox1.Items.Add("Kolkata")
    5.         ListBox1.Items.Add("Londan")       
    6. End Sub
    7.  ListBox1_MouseDown
    8. If ListBox1.Items.Count = 0 Then
    9.             Return
    10.         End If
    11.         Dim index As Integer = ListBox1.IndexFromPoint(e.X, e.Y)
    12.         Dim sourceStr As String = ListBox1.Items(index).ToString()
    13.         Dim objDragDropEff As DragDropEffects = DoDragDrop(sourceStr, DragDropEffects.All)
    14.         If objDragDropEff = DragDropEffects.All Then
    15.             ListBox1.Items.RemoveAt(ListBox1.IndexFromPoint(e.X, e.Y))
    16.         End If
    17.     End Sub
    18. ListBox2_DragEnter
    19. e.Effect = DragDropEffects.All
    20.     End Sub
    21. ListBox2_DragDrop
    22. Dim str As String = CStr(e.Data.GetData(DataFormats.StringFormat))
    23.         ListBox2.Items.Add(str)
    24.     End Sub

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

Top Posters Weekly

Optimum Creative