السلام عليكم ورحمة الله وبركاته
تفضل مثال جاهز في المرفقات
السلام عليكم ورحمة الله وبركاته
تفضل مثال جاهز في المرفقات
كود :
Option Explicit
'' 2 ListBox
Private Sub Form_Load()
List1.AddItem "عبدالله"
List1.AddItem "محمد"
List1.AddItem "جمال"
List1.AddItem "مصطفى"
List1.OLEDropMode = vbOLEDropManual
List2.OLEDropMode = vbOLEDropManual
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List1.OLEDrag
End Sub
Private Sub List1_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
AllowedEffects = vbDropEffectMove
Data.SetData List1
End Sub
Private Sub List2_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim strList As String
If Not Data.GetFormat(vbCFText) Then Exit Sub
strList = Data.GetData(vbCFText)
If Not strList = List2.Text Then
List2.AddItem strList
List1.RemoveItem List1.ListIndex
End If
End Sub
Private Sub List2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List2.OLEDrag
End Sub
Private Sub List2_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
AllowedEffects = vbDropEffectMove
Data.SetData List2
End Sub
Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim strList As String
If Not Data.GetFormat(vbCFText) Then Exit Sub
strList = Data.GetData(vbCFText)
If Not strList = List1.Text Then
List1.AddItem strList
List2.RemoveItem List2.ListIndex
End If
End Subالسلام عليكم ورحمة الله وبركاته
