Y could not move the listbox admin no to another listbox

Private Sub btnAssign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAssign.Click

    'If ListBoxassign.SelectedItem IsNot Nothing Then

    ListBoxall.Items.Add(ListBoxassign.SelectedItem)
    'End If
End Sub

Private Sub btnUnassign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnassign.Click
    ListBoxassign.Items.Remove(ListBoxassign.SelectedItem)
End Sub

End Class

Recommended Answers

The general method is:

Do While (ListBox1.SelectedItems.Count > 0)
    ListBox1.Items.Remove(ListBox1.SelectedItem)
Loop

You might be also interested in this:
http://www.codeproject.com/Tips/170900/How-to-Delete-Selected-Items-of-ListView-and-ListB

Jump to Post

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.