file.vb
Private Sub cmdAddLeft_Click()
List1.AddItem (inputBox("Enter Item"))
End Sub
Private Sub cmdAddRight_Click()
Item = inputBox("Enter Item: ", "Left List")
For i = 0 TolstRight.ListCount - 1
If lstRight.List(i) = Item Then
MsgBox "Record Is Already Present In The List.", vbOKOnly, "Result"
Exit Sub
End If
lstRight.AddItem Item
Next
End Sub
Private Sub cmdRemoveLeft_Click()
If lstRight.ListCount = 0 Then
MsgBox ("No more items to delete")
End
Else
lstRight.RemoveItem (0)
End If
End Sub
Private Sub cmdRemoveRight_Click()
If List1.ListCount = 0 Then
MsgBox ("No more items to delete")
End
Else
List1.RemoveItem (0)
End If
End Sub
Private Sub Command1_Click()
cnt = lstRight.ListCount
If List1.ListCount = 0 Then
MsgBox ("No more items to Move")
Exit Sub
Else
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) = True Then
For j = lstRight.ListCount - 1 To 0 Step -1
If lstRight.List(j) <> List1.List(i) Then
lstRight.AddItem (List1.List(i))
List1.RemoveItem (i)
Else
MsgBox ("Item "& List1.Selected(i) & "already exist")
End If
Next
End If
Next
End If
End Sub
Private Sub Command2_Click()
If List2.ListCount = 0 Then
MsgBox ("No more items to Move")
Exit Sub
Else
List1.AddItem (List2.List(ListIndex))
List2.RemoveItem (ListIndex)
End If
End Sub