Library code snippets

Remove the selected items in a ListBox

This is how to remove all selected items from a listbox

Just do: Call ListBoxRemSel List1

replace List1 with the name of your listbox..

Sub ListBoxRemSel(lst As ListBox)
    Do Until lst.SelCount = 0
        If lst.Selected(a) Then lst.RemoveItem a: a = a - 1
        a = a + 1
    Loop
End Sub

Comments

  1. 22 Nov 2001 at 17:58
    you forgot to add    "Dim a as integer"   otherwise the code wont work

    Sub ListBoxRemSel(lst As ListBox)
    Dim a as integer
       Do Until lst.SelCount = 0
           If lst.Selected(a) Then lst.RemoveItem a: a = a - 1
           a = a + 1
       Loop
    End Sub
  2. 01 Jan 1999 at 00:00

    This thread is for discussions of Remove the selected items in a ListBox.

Leave a comment

Sign in or Join us (it's free).

Kym Manson Till the Roof comes off Till the Lights go out Till my Legs give out Can't shut my mouth I will not fall, my Wisdoms all.
AddThis

Related discussion

Related podcasts

  • Christian Beauclair

    14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...

Want to stay in touch with what's going on? Follow us on twitter!