VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Populate and Remove items from a list box.

by Richard Bishop (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 13th May 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Populate and Remove items from a list box.

API Declarations


Set the listbox style property to 1 - Checkbox
Call the first command button cmdFill
Call the second command button cmdRemove

Rate Populate and Remove items from a list box.




Dim i As Integer

Private Sub cmdFill_Click()
    For i = 1 To 20
        List1.AddItem i
    Next i
End Sub

Private Sub cmdRemove_Click()
    
    Dim i As Integer
    
    For i = List1.ListCount - 1 To 0 Step -1
        If List1.Selected(i) = True Then
           List1.RemoveItem (i)
        End If
    Next i
        
End Sub


Download this snippet    Add to My Saved Code

Populate and Remove items from a list box. Comments

No comments have been posted about Populate and Remove items from a list box.. Why not be the first to post a comment about Populate and Remove items from a list box..

Post your comment

Subject:
Message:
0/1000 characters