7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command2_Click() '逐个添加到右侧
Dim i As Long
If Me.List1.ListIndex = -1 Then Exit Sub '没有选中则退出
For i = 0 To List2.ListCount - 1
If List1.Text = List2.List(i) Then Exit Sub
Next i
List2.AddItem List1.Text '右侧没有,且左侧有选中条目时,添加到右侧
End Sub
Private Sub List1_Click()
Dim i As Long
For i = 0 To List2.ListCount - 1
If List1.Text = List2.List(i) Then '如果右侧已存在相同内容
MsgBox "弹窗提示"
Exit Sub
End If
Next i
End Sub