Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. [VB.NET] Drag & Drop multiselection on listview

[VB.NET] Drag & Drop multiselection on listview

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sebastien Curutchet
    wrote on last edited by
    #1

    I'm trying to use drag & drop with a multiselection. I would like to copy the listview selected items on an other listview. I tried that : Private Sub lstAllRole_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstAllRole.MouseDown lstAllRole.DoDragDrop(lstAllRole.SelectedItems, DragDropEffects.Copy) End Sub Private Sub lstRole_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lstRole.DragEnter ' If e.Data().GetDataPresent("System.Windows.Forms.ListView.ListViewItemCollection", False) Then If e.Data().GetDataPresent(lstAllRole.SelectedItems.GetType().ToString(), False) Then e.Effect() = DragDropEffects.Copy Else e.Effect() = DragDropEffects.None End If End Sub Private Sub lstRole_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lstRole.DragDrop Dim obj As ListViewItem Dim objCol As Object For Each obj In e.Data.GetData(lstAllRole.SelectedItems.GetType().ToString(), False) lstRole.Items.Add(obj) Next End Sub The drag & drop works but not the copy. Does someone already do it ? Thanks

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups