如何将文件列表框中所选择的对象一次性添加到列表框中
使用列表框将一个列表框中的内容移动到另一个列表框中
如何实现向左/右移动多个选择的项?
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
If List1.ListCount = 0 Then
Exit Sub
End If
If List1.ListIndex = -1 Then
List1.SetFocus
List1.Selected(0) = True
End If
DoEvents
List2.AddItem List1.Text
List1.RemoveItem List1.ListIndex
Case 1
If List1.ListCount = 0 Then
Exit Sub
End If
If List1.ListIndex = -1 Then
List1.SetFocus
List1.Selected(0) = True
End If
DoEvents
For i = (List1.ListCount - 1) To 0 Step -1
List2.AddItem List1.List(i)
DoEvents
Next i
List1.Clear
Case 2
If List2.ListCount = 0 Then
Exit Sub
End If
If List2.ListIndex = -1 Then
List2.SetFocus
List2.Selected(0) = True
End If
List1.AddItem List2.Text
List2.RemoveItem List2.ListIndex
Case 3
If List2.ListCount = 0 Then
Exit Sub
End If
If List2.ListIndex = -1 Then
List2.SetFocus
List2.Selected(0) = True
End If
For i = (List2.ListCount - 1) To 0 Step -1
List1.AddItem List2.List(i)
DoEvents
Next i
List2.Clear
End Select
End Sub
Private Sub Form_Load()
List1.AddItem "姓名", 0
List1.AddItem "性别", 1
List1.AddItem "年龄", 2
List1.AddItem "籍贯", 3
List1.AddItem "文化程度", 4
End Sub
[ 本帖最后由 tszhaoweiwen 于 2015-7-15 16:55 编辑 ]