Realisieren von Multiselect bei Drag and Drop
12.05.2007 18:07:00
Multiselect
Ich will mehrfachMarkiertes von Listbox1 in Listbox2 verschieben, schaffe es aber nicht.
Bei Beginn von Drag kommt die Fehlermeldung: Unzulässige Verwendung von Null
(bei SingleSelect funktioniert es aber)
Mein bisher verwendeter Code (In UF sind 2 Listboxen vorhanden):
Der Code stammt aus der Excelhilfe.
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 = False
Effect = 1
ListBox2.AddItem Data.GetText
If ListBox1.ListCount >= 1 Then ListBox1.RemoveItem (ListBox1.ListIndex)
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
If Button = 1 Then
Set MyDataObject = New DataObject
Dim Effect As Integer
MyDataObject.SetText ListBox1.Value
Dim i As Integer
Effect = MyDataObject.StartDrag
End If
End Sub
Hat jemand ne Idee woran`s liegt?
Danke im Voraus
Lorenz