MultiSelect bei Drag & Drop will nicht!
24.11.2006 08:13:29
Lorenz
Wie kann man mit "MehrfachMarkierung" mehrere Einträge aus ListBox1 nach ListBox2 verschieben?
Mit folgendem Code werden Texte(zeilen) per Drag & Drop aus ListBox1 in ListBox2 verschoben!
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 = 2
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 = 3
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
Effect = MyDataObject.StartDrag
End If
End Sub
Wenn bei den Listbox-Eigenschaften "MultiSelect" auf 1 od. 2 umgestellt wird gibts Fehlermeldung "unzulässige Verwendung von Null" (Laufzeitfehler 94)
Was muß bei genannten Code geändert werden?
Gruss
Lorenz