|
-
Oct 10th, 2000, 10:38 AM
#1
Thread Starter
Hyperactive Member
Would it be possible to drag one value from a (a)list box into another (b)list box?
And if so if I dragged more than one value into the (b)list box would it add then next value or overwright the first value?
-
Oct 10th, 2000, 10:49 AM
#2
Fanatic Member
Yes it is possible.
I will reply again with code.
-
Oct 10th, 2000, 11:06 AM
#3
Fanatic Member
Code:
Private Sub Form_Load()
With Lista
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
.AddItem "6"
.AddItem "7"
.AddItem "8"
.AddItem "9"
End With
End Sub
Private Sub Lista_OLESetData(Data As DataObject, DataFormat As Integer)
Data.SetData Lista.List(Lista.ListIndex)
End Sub
Private Sub Listb_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
With Listb
.AddItem Data.GetData(1)
End With
End Sub
You have to set the OLEDragMode to 1-Automatic for lista and the dropmode to 1-manual for listb.
-
Oct 10th, 2000, 02:08 PM
#4
You could also do this:
Code:
'Code from Megatron
Dim StartDrag As Boolean
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
StartDrag = True
strTemp = List1.Text
End Sub
Private Sub List2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If StartDrag = True Then
List2.AddItem List1.Text
List1.RemoveItem List1.ListIndex
End If
StartDrag = False
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|