2015-10-21 136 views

回答

0

假设SelectionMode设置为One,并且要复制所选项目:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
    If ListBox1.SelectedIndex <> -1 Then 
     ListBox2.Items.Add(ListBox1.SelectedItem) 
    End If 
End Sub 

如果你想移动选择的项目,则:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
    If ListBox1.SelectedIndex <> -1 Then 
     ListBox2.Items.Add(ListBox1.SelectedItem) 
     ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) 
    End If 
End Sub 
相关问题