Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Drag And Drop From Listview To Another Listview


Hey Guys,

I've think i've tried everything but cant get it to work. I can get it to work to a text box or a list bow but not to another Listview!!

Anyone know how to drag the contents of a listview to another listview??

b




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
ListView -Drag&Drop- ListView
Does anybody have an example about how to do a Drag & Drop of items between two ListViews? Any help would be welcome. Thanks, in advance.

Listview Drag And Drop
Hi,
i have a listview set up as a listing of files.

I have the drop function up and running so the user can drop files straight into the list but what i can get working is the drop function.

All i want to be able to do is have the user drag the selected items from the list outside the form and return the address of where the files are to be dropped as a message box.

If anyone can help or point me in the right direction it would be great,
-Dave

Listview Drag & Drop
Hello,
Can someone please point me in the direction of an example of using drag & drop within listview. I've been searching the web and keep coming up empty handed!

What I'm trying to do is something like Winamp does in it's playlist for example. I would like to be able to drag a full row of data and drop it in another row.
Thank you!

Listview Drag N Drop
Hi anyone have any ideas how to create a drag N drop between two listviews? I keep coming up with an error with this code, the line that is red is where the error comes up:


Private Sub lstview1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim c As Long

Set lstview1.SelectedItem = lstview1.HitTest(X, Y)
c = lstview1.SelectedItem.Index
lstview1.DragIcon = images.ItemIndex(3)
lstview1.Drag vbBeginDrag

End Sub



Private Sub lstview2_DragDrop(Source As Control, X As Single, Y As Single)
Dim LI2 As ListItem, LI3 As ListItem, i As Byte
Set LI3 = lstview2.HitTest(X, Y)
If LI3 Is Nothing = False Then
Set LI2 = lstview2.ListItems.Add(LI3.Index + IIf(LI3.Index < Source.SelectedItem.Index, 0, 1), , Source.SelectedItem.Text)
Else
Set LI2 = lstview2.ListItems.Add(, , Source.SelectedItem.Text)
End If
For i = 1 To lstview2.ColumnHeaders.Count - 1
LI2.SubItems(i) = lstview2.SelectedItem.SubItems(i)
Next i
lstview2.ListItems.Remove lstview1.SelectedItem.Index
LI2.Selected = True

End Sub

Drag &amp; Drop In Listview
Hi Everone!

I would like to know, how I can drag & drop rows IN a listview.
I've seen some examples for a listbox, but not for a listview...

Thanks a lot!

Greetz Kevin,

ListView Drag 'n Drop
I have most of the functionality for dragging and item from a listview and setting the text in a textbox to that data. However, when I drag the the item I get a drag icon that to the user code be interpreted as dragging the whole list. Basically, instead of a small rectangle I'm getting a big one. How would I go about fixing it?


Code:
Dim strHolder As String
Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not (ListView1.HitTest(X, Y) Is Nothing) Then
ListView1.HitTest(X, Y).Selected = True
strHolder = ListView1.SelectedItem.Text
ListView1.Drag
End If
End Sub

Private Sub Text1_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is ListView Then
Text1.Text = strHolder
End If
End Sub

Private Sub Text1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
If TypeOf Source Is ListView Then
If State = 0 Then Text1.BackColor = &HFFFFC0
If State = 1 Then Text1.BackColor = &HFFFFFF
End If
End Sub

Help With Listview Drag And Drop
I have a listview with folders on top with files listed after them. I want the user to be able to drag and drop a file into a folder. I know this can be done with drag and drop, however is there a way to auto scroll up or down when the user drags the file that way.

Thanks

Help With Drag/drop From Listview
I have a ListView control and a number of text boxes.
When I try and drag/drop from the listview to a text box or list box
I get the error 438
'Object doesn't support this property or method'
can any one help ??

Drag And Drop On ListView
Is there a way to use a drag and drop operation on a listview control itself. For example if I wanted to move a file on a listview control to a folder in the same listview control. Can this be done?

Thanks

Listview Drag Drop
How do you drag a row in a list view box an drop it to another part of the list view so that the row is inserted between the two rows where the drop occurs.

Listview Drag And Drop
Does anyone know how I can drag and drop multiple values from one listview to another. Using the listview_OLEDragDrop event I can transfer 1 value, but it doesn't work if my source listview allows multiselect.

Listview Drag And Drop
Hello there,

I have a listview with 3 columns.
I Want to drag the 3 colums to a textbox.
I use the statement CentralMemoListFrm.liMemo.SelectedItem = CentralMemoListFrm.liMemo.HitTest(X, Y) to determine which row us selected.
But this statement selects the text of the first column instead of the third.

Does anybody know how to select the text of the 3 column of the row selected?

Many thankx!!!

Drag Drop With ListView
Yeap... I missed the cDItem class. Here you have the code. Hope it helps.

ListView Drag And Drop
How can I do drag and drop with a listview?

Drag+drop Listview
How can I drag at list view item (it should show the icon I specify when it is being dragged) into a richtextbox, then have text go in the rich text box where I drag the listview item to?

Drag And Drop Within Listview
Hi,

I've been using VB6 for a while now, and I've created a couple of programs from it. I've recently started using OLE Drag and Drop to be able to do several things, and all seems well when "copying" an item within the same listview. However, I can't work out how to "move" an item within the same listview. I am able to code it to the point whereby it can detect whether I want to move or copy the item, and whilst I know what to do to copy an item, I do not know how to move an item within a list view.

I hope this makes sense, and if anyone has the answer (which is probably pretty easy), it would be much appriciated.

Tim.

Drag N Drop With ListView
I would like to drag an item from one list to another
I could use a sample and some property settings

Thanks in advance

Thom Boglino
CLC Education
Thom Boglino :)
The Computer Learning Center
727-847-6955
352-683-7255
email@removed
email@removed

*Copyright (c) confidential message. No redistribution.
This message is intended for the use of the addressee
only and may contain confidential or privileged information.
If you have received it in error please notify the sender
and destroy it. You may not use it or copy it to anyone else.

How To Drag And Drop In Listview?
Hi guys,

I'm using VB.NET.

I have a simple application. Just a form, and a ListView.

I have a procedure in the form, it read's all the files in my specificed local drive, and show the files name, size and created day. It works perfectly.

Now, I want add a drag and drop functionality in this application. For example, when I drag a file from my desktop, and drop it in the list box, it will do the following:

  - Add the file's name, size and date into the listview
  - Copy the file to my another specificed path

My problem is simple, I don't know how to do it! :)

Can anyone give me a sample code and let me figure it out, or give me some hints, advice or anything can help.

Thanks in advance :)

Andy

ListView Drag And Drop
how can i drag from a listview and drop in another control, like listbox or flexgrid

Drag Drop With A Listview
i have a listview that has to colums. i want to be able to drag an item and drop the information (from the 2 columns) to another part of the form, like a label.

can anyone help me with this????

gkc

Drag And Drop In ListView
Hi,
I am trying to drag and drop multiple items from a listview on to a treeview node which will ultimately be updated in a corresponding table in the database(just like selecting multiple files in windows explorer and copying to different nodes).My problem is I am not able to drag all the items that I select.When I drag only one Item gets selected,Could somebody help me with this problem or give me some suggestions.Any suggestions will be highly appreciated.
Thanks in Advance
Cheers,
Suvipra

Drag And Drop From Listview Onto Listbox
I need to be able to perform a drag'n'drop from a listview in report-view mode onto a listbox.

I can get the first item (I want to multiple select too) that is dropped, however I cannot do the following:

1) I want multiple, performing a For Each vfn In Data.GetData(1) doesn't work, I get can the first item by msgbox data.getdata(1)

2) The destination listbox, how can I tell what item in the listbox that the dragged objects have landed on.

Cheers!

Carl.

Listview Drag Drop To Folder
I have 2 listviews. One is a list of folders and the other is a list of files. I want to be able to drag selected files to a folder in my list of folders.

Thanks

Drag&amp;Drop And Multiselect In Listview
Hi,

i have a litle problem.
I have activate multiselect on my listview.
But the multiselect doesen't works. I know why.

I have the MouseDown option for the drag&drop:


Code:
Private Sub PN_ChartVersionList_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Shift = vbAltMask Then
Set PN_ChartVersionList.SelectedItem = PN_ChartVersionList.HitTest(X, Y)

If Not PN_ChartVersionList.SelectedItem Is Nothing Then

PN_ChartVersionList.Drag vbBeginDrag
End If
End If

'PN_ChartVersionList.SelectedItem = Nothing
End Sub

yet i must let held down the alt key to drag and drop because otherwise the mutliselect doesen't works.

How can I resolv this problem, that i can drag&drop or multiselect the items without press any keys exept for the multiselect the (ctrl + shift) key.

sry for my english :/

Drag&amp;Drop Between TreeView And ListView
Hi,

How can i drag&drop items between a TreeView and a ListView?

best regards,
z3r0x

Treeview/Listview Drag And Drop
Hello.

I have 2 questions about dragging into a listview:

1)
Where can I get the code for dragging a specific node from a treeview, into a listview (I just need to add the value of the dragged node as a new record in the listview).

2)
I also look for the code for dragging a file from the desktop into a listview. There are lots of exmaples on the internet for doing this, but I need to drag a file into a listview control (and not any other control).

Thanks,
Edi.

P.S.
I use VB6 and not .NET

Drag And Drop Into Listview Crashes VB
Hi,

I have two multiselect listviews in which I have OLEDrag methods/events handling drag/drop of listitems between them. If I select all of the listitems from one listview, drag and drop into another, it will *usually* cause the VB IDE to crash with a general protection fault! I've tried everything to track this one down and now I'm at my wit's end.

The problem relates only to the OLE drag/drop since I can move the same listitems via a command button (click) procedure call and it works reliably every time.

I cannot be the only one who has experienced this, so if any one has seen this sort of behavior before, please contact me! I'm running VB6 SP6, with latest mscomctl.ocx (6.1.97.86)

Much thanks,
PJ

Listview (Report) Row Drag &amp; Drop
Hi,

I have a listview on a form which has items in it, what I would like to do is enable the user to drag & drop (manual sort) a row within the listview.

The list view is in report mode.

The following is what i have so far, but it only removes the row to the end of the list, how do I reference the index after drop to insert the row I am moving?

[[ code ]]

Private Sub Form_Load()
Dim Li As ListItem

ListView1.ColumnHeaders.Add , , "1"

Set Li = ListView1.ListItems.Add(, , "hello")
Set Li = ListView1.ListItems.Add(, , "hello2")
Set Li = ListView1.ListItems.Add(, , "hello3")
Set Li = ListView1.ListItems.Add(, , "hello4")
Set Li = ListView1.ListItems.Add(, , "hello5")
Set Li = ListView1.ListItems.Add(, , "hello6")

End Sub

Private Sub ListView1_MouseDown(Button As Integer, Shift As Integer, _
x As Single, y As Single)
Dim c As Long
Set ListView1.SelectedItem = ListView1.HitTest(x, y)
c = ListView1.SelectedItem.Index
ListView1.DragIcon = LoadPicture("C: est.ico")
ListView1.Drag vbBeginDrag
End Sub

Private Sub ListView1_DragDrop(Source As Control, x As Single, _
y As Single)
Dim li2 As ListItem
Set li2 = ListView1.ListItems.Add(, , Source.SelectedItem.Text)
ListView1.ListItems.Remove ListView1.SelectedItem.Index
End Sub

[[End Code]]

Basically I am trying to move one entire row with a listview. Thanks alot for any help provided, I have been pulling my hair out on this one!

Rgds,
Dan

Drag-drop Listview Items?
How can i ...(The Title)

Drag &amp; Drop Within A Listbox Or Listview?
Let's say you have a listbox containing 50 items (rows) that is populated from a database table. That listbox is sorted 1 through 50 based on a field called "ORDER".

If I want to allow the user of my VB application to change the order of the records (and the order field accordingly) using drag and drop, is that possible? What I'm thinking is that they can click on, say, item 32 in the list, and drag it up or down the list to the spot they are looking for and then my program will reorder everything.

Basically, my software has a combobox that is populated and ordered using this table. On certain occaisions the user has to change this order (for data entry purposes), so they need a fast way to go about this. The way the previous programmer made it, once they order one thing differently, they have to go all the way through the list again and reorder everything else. Any tips on how to make this smooth and relativley effortless for the end user would be appreciated.

Thanks again everyone

Another ListView Drag Drop Question
Hi All,

Please tell me how to do this. When I drag across from one listview to another I want the dragimage to show the actual text being dragged accross but with sort of a watermarked effect. Any help would be greatly appreciated.

Thanks.

Listview Drag And Drop Issues
Hi All,

I have the following code that enables me to drag and drop an item from 1 listview to another. The way it works is,if I drag and itemfrom inventory to a listview for a site then the quantity in inventory is decreased and the quantity at the site increases.

The problem is, if I drag across to the site listview without releasing the left mouse button and drag back to the original listview then an error must occur. As it stands now, if I do the above the code for the dragging from site back to inventory kicks is.
Code:
Private Sub lvwSite_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim con As ADODB.Connection
Dim itType As Integer
Dim iQty As String
Dim iSite As Integer
Dim j As Integer
Dim k As Integer
Dim IsNotAvail As Boolean
Dim l As Integer
Dim QuanAvail As Integer

Set con = GetConnection

IsNotAvail = False
itType = CInt(Mid(lstList.SelectedItem.Key, 2))

If itType > 0 Then

If cboSite.ListIndex >= 0 Then
iSite = cboSite.ItemData(cboSite.ListIndex)
Else
iSite = 0
End If

If iSite > 0 Then

For j = 1 To lstList.ListItems.Count
If lstList.ListItems(j).Selected = True Then
For k = 1 To lstList.ListItems(j).ListSubItems.Count
If lstList.ListItems(j).ListSubItems(k).ForeColor = vbRed Then
IsNotAvail = True
Exit For
Else
IsNotAvail = False
End If
Next k
End If
Next j

For l = 1 To lstList.ListItems.Count

If lstList.ListItems(l).Selected = True Then

QuanAvail = IIf(IsNull(lstList.ListItems(l).SubItems(2)) Or (lstList.ListItems(l).SubItems(2) = ""), 0, lstList.ListItems(l).SubItems(2))

End If

Next l

If IsNotAvail = False Then

iQty = InputBox("Enter Quantity", "Quantity being Allocated")

If IsNumeric(iQty) Then

If (CInt(iQty) > CInt(QuanAvail)) Then

MsgBox "Quantity being Allocated Exceeds Quantity Available", vbCritical, "Task incomplete"
Exit Sub

Else
con.Execute ("CALL P_ItemBorrow(" & CInt(itType) & "," & CInt(iQty) & "," & iSite & ")")
Call LoadSite(cboSite.ItemData(cboSite.ListIndex))
Call LoadList(CInt(iTemTyp))
'Call LVDragDropMulti(lstList, x, y, lvwSite)
End If

Else
MsgBox "Please enter a Numeric value", vbCritical, "Error"
Exit Sub
End If
Else
MsgBox "Item Not available for Allocation", vbExclamation, "Unavailable"
Exit Sub
End If
Else

MsgBox "Please Select a Site for Allocation", vbCritical, "Error"
cboSite.SetFocus
Exit Sub

End If
Else
MsgBox "Please Choose an Item", vbCritical, "Error"
Exit Sub
End If
End Sub
please help!!!!

Treeview/Listview Drag And Drop
Hello.

I have 2 questions about dragging into a listview:

1)
Where can I get the code for dragging a specific node from a treeview, into a listview (I just need to add the value of the dragged node as a new record in the listview).

2)
I also look for the code for dragging a file from the desktop into a listview. There are lots of exmaples on the internet for doing this, but I need to drag a file into a listview control (and not any other control).

Thanks,
Edi.

P.S.
I use VB6 and not .NET

Drag And Drop Between ListView AND Treeview...OLE Or Otherwise, Anyone?
I have searched and search, and only found 1/2 arsed methods to deal with drag and drop correctly.
Does anyone know the correct way to use OLE drag to drag a listitem and add it to a treeview node.

The exmaples on VBF are not what i am looking for, neither are the ones on FreeVBCode.com

Help.

Woka

Listview Drag Drop Question
I have a question on how to drag an item from one listview control to another. I have searched the other posts on here but no clear way of how to do this.

I want to click on one item in a listview and drag a copy of it to another listview control. From pieces of other messages here, I tried stuff and it looks like I am dragging the whole box over.

Does anyone have an example of how to do this and where the mouse icon looks like an item being dragged?

I greatly appreciate this!

Drag &amp; Drop File(s) Into A Listview
How can i drag multi files or a file from outside the app, lets say from the desktop, and drop it into my listview?

Listview - Drag &amp; Drop Scrolling
When I'm "in drag" within a listview and have many items in the list (ie, have a vertical scrollbar), and drag below the listview box I want it to scroll down one item at a time in order to choose the spot to drop. Also when I go above the box. I know I can use the ensurevisible property in a loop to get the one item at a time visible, but how can I determine where the mousemove is when listview loses focus (ie top vs bottom vs side....)?

Drag And Drop Items In A Listview
Is there an easy way to rearrange the order of the items in a listview with a drag-drop operation? I tried using the HitTest method and some drag/drop events but it is kinda clunky.

Reordering A Listview With Drag And Drop
I'm using VisualBasic.net and I have a listview that acts as a music playlist. I want to be able to move items around in the playlist by dragging and dropping them. Right now the user has to click a button to move the items up or down one row at a time. I am able to drag and drop between different listviews, but i haven't figured out how to do it within a single listview. Any ideas? Thanks for your time.

Drag &amp; Drop In ListView And PictureBox
Hello Gurus!

I'm wondering something about manual Drag & Drop in ListView.
Source is ListView and Target is PictureBox.
ListView has image items.
What I would do is :
There's an icon on each items of the ListView.
Drag one item(icon) and drag on picture box, then the item of
the listview is copied to the picturebox.

Question is :
1. How can extract one item in OLEStartDrag event?
2. I would pass the file name to the target, then what format
should I use? vbCFText? or vbCFFiles? or other format?

Could anybody help me?

P.S) If have some sample source code, can you let me refer to it?

Please Help Me With Drag-n-Drop Of Multiple Items From One Listview To Another.
Hello!

I'm facing a problem with Listview Drog and Drop of multiple items from one listview to another listview. When I try to Drag only one single item, the item is dragged without any problem. However, when the multiple selected items are dragged, the Listview on which the items are dropped, receives information about only one item and not all selected items. The item, about which the information is received, is the same on which I click and hold mouse to start drag action. So, it looks like even though multiple items are selected in a listview, while executing the Drag-Drop action, listview treats it as single item selected!

Is this a default behavior of Listview or am I missing/doing anything wrong? Any work-around for this (seems like default) behavior of Listview? I searched for it and got a code example at http://btmtz.mvps.org/listview/ where the author has demonstrated Drag-Drop of multiple items. However, the code is specifically restricted to re-arranging items within same Listview and the information is transported via Drag-Drop to another Listview, upon which the items are dropped.

To help you all to get a better insight of my problem, I have attached a Demo of Listview Drag-n-Drop. Please see the project and you will see that when one item is dragged from left side Listview to right side Listview, no problem for VB to allow me to do it! However, when you select multiple items in left side Listview and try dragging those to right side Listview, only one item is dragged. Please let me know if I'm doing anything wrong here and please help me to get this stuff to work!

Waiting for your valuable reply ...

Regards,

Ruturaj.

Drag And Drop Column Headers Listview
Hi,

How can I drag and drop column headers (and all the sub items) so that the user can reorder there view?

Many thanks

Ed

LIstview &amp; Treeview Drag And Drop Problems
Ok, I have two problems that I would really appreciate some help with. In my program I have a treeview, a listview and a webbrowser. When you expand a treeview node the Listview is populated with file paths like 'C:WindowsDesktopTest1.txt' etc. Now when I click those the webbrowser opens the file (using webbrowser1.navigate (the path)) and displays the text. Here's where I hit my problem.

I'm trying to drag the file path from the listview to a different node in the treeview, but whenever I put in listview1.drag vbbegindrag and set the listview's dragmode to be vbAutomatic I can't select a specific item. When I click anywhere in the listview it gives me the drag icon, but without selecting a filepath first i'm not dragging anything. Has anyone run into this problem before? I need to be able to click it and have it display the file and also be able to drag it to a new treeview node. Thanks in advance for any help.

Listview Drag&amp;Drop For Specific Files
Hey,
I would like to know how can i enable drag and drop in a listview only for a specific type of files?

I know i can check if Right(Data.Files(i), 3) = extension (For example, in a loop), but maybe there's a better way to check the extension of the files?
Thanks

Please Help Me With Drag-n-Drop Of Multiple Items From One Listview To Another.
Hello!

I'm facing a problem with Listview Drog and Drop of multiple items from one listview to another listview. When I try to Drag only one single item, the item is dragged without any problem. However, when the multiple selected items are dragged, the Listview on which the items are dropped, receives information about only one item and not all selected items. The item, about which the information is received, is the same on which I click and hold mouse to start drag action. So, it looks like even though multiple items are selected in a listview, while executing the Drag-Drop action, listview treats it as single item selected!

Is this a default behavior of Listview or am I missing/doing anything wrong? Any work-around for this (seems like default) behavior of Listview? I searched for it and got a code example at http://btmtz.mvps.org/listview/ where the author has demonstrated Drag-Drop of multiple items. However, the code is specifically restricted to re-arranging items within same Listview and the information is transported via Drag-Drop to another Listview, upon which the items are dropped.

To help you all to get a better insight of my problem, I have attached a Demo of Listview Drag-n-Drop. Please see the project and you will see that when one item is dragged from left side Listview to right side Listview, no problem for VB to allow me to do it! However, when you select multiple items in left side Listview and try dragging those to right side Listview, only one item is dragged. Please let me know if I'm doing anything wrong here and please help me to get this stuff to work!

Waiting for your valuable reply ...

Regards,

Ruturaj.

How To Implement Drag&amp;Drop Between ListView Controls?
I'm trying to implement the option to Drag an Item of one ListView to another ListView in the same form but so far I haven't been able to find an example in the MSDN on how to do that...

can anyone set me on the right track?

Thanks!

Listview - Drag &amp; Drop An Item In The List
Is it possible with the Listview control, and if so how, to drag an item in a list and drop it into another position in the list? I also want the index number to change appropriately, but the key for that item to stay the same? Any ideas?

ListView Report Mode Drag And Drop-please
I have this listview in report mode, but I want the user to be able to change the order of things, preferably by dragging and dropping, inside that one box. If you have any idea, I'd be glad to hear. note: it's not a listbox, and there aren't two boxes, just one listview that needs it's order changed around a bit.

bob

Please Help Me With Drag-n-Drop Of Multiple Items From One Listview To Another.
Hello!

I'm facing a problem with Listview Drog and Drop of multiple items from one listview to another listview. When I try to Drag only one single item, the item is dragged without any problem. However, when the multiple selected items are dragged, the Listview on which the items are dropped, receives information about only one item and not all selected items. The item, about which the information is received, is the same on which I click and hold mouse to start drag action. So, it looks like even though multiple items are selected in a listview, while executing the Drag-Drop action, listview treats it as single item selected!

Is this a default behavior of Listview or am I missing/doing anything wrong? Any work-around for this (seems like default) behavior of Listview? I searched for it and got a code example at http://btmtz.mvps.org/listview/ where the author has demonstrated Drag-Drop of multiple items. However, the code is specifically restricted to re-arranging items within same Listview and the information is transported via Drag-Drop to another Listview, upon which the items are dropped.

To help you all to get a better insight of my problem, I have attached a Demo of Listview Drag-n-Drop. Please see the project and you will see that when one item is dragged from left side Listview to right side Listview, no problem for VB to allow me to do it! However, when you select multiple items in left side Listview and try dragging those to right side Listview, only one item is dragged. Please let me know if I'm doing anything wrong here and please help me to get this stuff to work!

Waiting for your valuable reply ...

Regards,

Ruturaj.

Copyright © 2005-08 www.BigResource.com, All rights reserved