WelshyWizard
IS-IT--Management
Hi all,
I've got the following code which allows me to drag and drop muitiselected rows from one listbox to another. However, I the listbox I'm dragging from is multicolumn and I want all columns to be taken over in the drag, not just the 1st one (which is what is happening).
Any ideas how I do it?
Cheers
Today is the tomorrow you worried about yesterday - and all is well.....
I've got the following code which allows me to drag and drop muitiselected rows from one listbox to another. However, I the listbox I'm dragging from is multicolumn and I want all columns to be taken over in the drag, not just the 1st one (which is what is happening).
Code:
Private Sub ListBox2_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As Long, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = 1
End Sub
Private Sub ListBox2_BeforeDropOrPaste(ByVal Cancel As MSForms.ReturnBoolean, ByVal Action As Long, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)
Cancel = True
Effect = fmDropEffectMove
Dim I
With ListBox1
For I = 0 To .ListCount - 1
If .Selected(I) Then
ListBox2.AddItem .List(I)
End If
Next
End With
End Sub
Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim MyDataObject As DataObject
Dim I, cnt
If Button = 2 Then 'Use the right Mouse button to drag.
Set MyDataObject = New DataObject
Dim Effect As Integer
MyDataObject.SetText ListBox1.List(ListBox1.ListIndex)
Effect = MyDataObject.StartDrag
End If
End Sub
Any ideas how I do it?
Cheers
Today is the tomorrow you worried about yesterday - and all is well.....