February 29th, 2000, 01:56 PM
Can you tell me how to implement Drag-Drop between 2 listboxes?
I want to drag an item from one listbox and drop it into another..
Thanx..
I want to drag an item from one listbox and drop it into another..
Thanx..
|
Click to See Complete Forum and Search --> : Drag-Drop from one Listbox to another February 29th, 2000, 01:56 PM Can you tell me how to implement Drag-Drop between 2 listboxes? I want to drag an item from one listbox and drop it into another.. Thanx.. Aaron Young February 29th, 2000, 02:19 PM Here's an example I threw together to demonstrate Dragging Items between Listboxes:'Add 2 Listboxes to a Form... private Sub Form_Load() Dim iIndex as Integer List1.DragMode = vbManual List2.DragMode = vbManual List1.DragIcon = LoadPicture("..\Common\Graphics\Icons\DragDrop\Drag1pg.ico") List2.DragIcon = LoadPicture("..\Common\Graphics\Icons\DragDrop\Drag1pg.ico") for iIndex = 1 to 10 List1.AddItem "Item " & Right$("00" & iIndex, 2) next End Sub private Sub List1_DragDrop(Source as Control, X as Single, Y as Single) If TypeOf Source is ListBox then If Source.Name = "List1" then Exit Sub List1.AddItem Source Source.RemoveItem Source.ListIndex End If End Sub private Sub List1_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single) If List1.ListIndex < 0 then Exit Sub If Button = vbLeftButton then List1.Drag vbBeginDrag End Sub private Sub List1_MouseUp(Button as Integer, Shift as Integer, X as Single, Y as Single) If Button = vbLeftButton then List1.Drag vbEndDrag End Sub private Sub List2_MouseMove(Button as Integer, Shift as Integer, X as Single, Y as Single) If List2.ListIndex < 0 then Exit Sub If Button = vbLeftButton then List2.Drag vbBeginDrag End Sub private Sub List2_MouseUp(Button as Integer, Shift as Integer, X as Single, Y as Single) If Button = vbLeftButton then List2.Drag vbEndDrag End Sub private Sub List2_DragDrop(Source as Control, X as Single, Y as Single) If TypeOf Source is ListBox then If Source.Name = "List2" then Exit Sub List2.AddItem Source Source.RemoveItem Source.ListIndex End If End Sub Aaron Young Analyst Programmer ajyoung@pressenter.com aarony@redwingsoftware.com Certified AllExperts Expert: http://www.allexperts.com/displayExpert.asp?Expert=11884 codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |