Private Sub Command1_Click()
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) Then
List2.AddItem List1.Text
List1.RemoveItem i
End If
Next i
End Sub
Private Sub Command2_Click()
For i = List2.ListCount - 1 To 0 Step -1
If List2.Selected(i) Then
List1.AddItem List2.Text
List2.RemoveItem i
End If
Next i
End Sub
Private Sub Command3_Click()
For i = List1.ListCount - 1 To 0 Step -1
List2.AddItem List1.List(i)
List1.RemoveItem i
Next i
End Sub
Private Sub Command4_Click()
For i = List2.ListCount - 1 To 0 Step -1
List1.AddItem List2.List(i)
List2.RemoveItem i
Next i
End Sub
Private Sub Form_Load()
With List1
.AddItem "北京"
.AddItem "上海"
.AddItem "天津"
.AddItem "广州"
.AddItem "深圳"
.AddItem "杭州"
End With
End Sub
Private Sub Command1_Click()
If List1.ListIndex < 0 Then Exit Sub
List2.AddItem List1.List(List1.ListIndex)
List1.RemoveItem List1.ListIndex
End Sub
Private Sub Command2_Click()
If List2.ListIndex < 0 Then Exit Sub
List1.AddItem List2.List(List2.ListIndex)
List2.RemoveItem List2.ListIndex
End Sub
Private Sub Command3_Click()
For i = 0 To List1.ListCount - 1
List2.AddItem List1.List(i)
Next
List1.Clear
End Sub
Private Sub Command4_Click()
For i = 0 To List2.ListCount - 1
List1.AddItem List2.List(i)
Next
List2.Clear
End Sub
Private Sub Form_Load()
List1.AddItem "北京"
List1.AddItem "上海"
List1.AddItem "天津"
List2.AddItem "广州"
List2.AddItem "深圳"
List2.AddItem "杭州"
List1.Selected(0) = True
Command1.Caption = ">"
Command2.Caption = "<"
Command3.Caption = ">>"
Command4.Caption = "<<"
End Sub