Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRightMove.Click, LstAll.DoubleClick      '右移数据 

       If LstAll.SelectedItems.Count > 0 Then 

           If LstPart.Items.Contains(LstAll.SelectedItem) Then Exit Sub 

           LstPart.Items.Add(LstAll.SelectedItem) 

           LstAll.Items.Remove(LstAll.SelectedItem) 

       End If 

   End Sub 

 

   Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLeftMove.Click, LstPart.DoubleClick         '左移数据 

       If LstPart.SelectedItems.Count > 0 Then 

           If LstAll.Items.Contains(LstPart.SelectedItem) Then Exit Sub 

           LstAll.Items.Add(LstPart.SelectedItem) 

           LstPart.Items.Remove(LstPart.SelectedItem) 

       End If 

   End Sub 

 

   Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRightAll.Click        '右移全部数据 

       If LstAll.Items.Count < 1 Then Exit Sub 

       ' Dim LstItem As Object 

       'For Each LstItem In LstAll.Items 

       '    If Not LstPart.Items.Contains(LstItem) Then 

       '        LstPart.Items.Add(LstItem) 

       '    End If 

       'Next 

       'Dim i As Integer, nCount As Integer 

       'nCount = LstAll.Items.Count 

       ''For i = 1 To nCount 

       ''    LstAll.Items.AddRange(LstAll.Items) 

       ''Next 

       '  LstAll.Items.Remov 

       LstPart.Items.AddRange(LstAll.Items) 

       LstAll.Items.Clear() 

   End Sub 

 

   Private Sub BtnLeftAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLeftAll.Click       '左移全部数据 

       If LstPart.Items.Count < 1 Then Exit Sub 

       'Dim LstItem As Object 

       'For Each LstItem In LstPart.SelectedItems 

       '    If Not LstAll.Items.Contains(LstItem) Then 

       '        LstAll.Items.Add(LstItem) 

       '    End If 

       '    'LstPart.Items.Remove(LstItem) 

       '    'Me.ListBox2.Items.AddRange(Me.ListBox1.Items) 

       '    'Me.ListBox1.Items.Clear() 

       'Next 

       'Dim i As Integer, nCount As Integer 

       'nCount = LstPart.SelectedItems.Count 

       'For i = 1 To nCount 

       '    LstPart.Items.Remove(LstPart.SelectedItem) 

       'Next 

       LstAll.Items.AddRange(LstPart.Items) 

       LstPart.Items.Clear() 

   End Sub 

 

  摘自:wl58796351的专栏