I would like to know how to multi select items in a ListView and drag it accross to a TreeView in any folders.
Please help if you can. I am just learning VB6.
OK, the general procedure is to change the DragMode property of the source control (a listview, in your case) to "Automatic". You can also set the DragIcon property to a nice icon at the same time.
When the user drags their mouse (which now looks like the icon you chose), that control's DragOver event fires. If that control is able to accept the drop, you'd change the drag icon to one that indicates to the user that they can let go of the mouse button now (using the Source.DragIcon parameter). One way for the control to determine if the drop is OK is to look at the Source parameter, which is a reference to the control where the drop started. You can check the source control's name property (or something similar) to see if you want to indicate it's OK to drop.
When the user lets go over a control, that control's DragDrop event gets fired. This has a similar set of parameters to the DragOver event -- namely the Source parameter. The tricky part is getting the data from the source control. The easiest way is when the drag operation begins is to store the data in a module-level variable (maybe a collection, maybe a user-defined structure). When the DragDrop event fires, you'd verify the Source control again, and then copy the values from the module-level variable into your new control.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.