VB6 newbie here. I've got a basic form containing a list box, with two command buttons; one to add items to the list, and one to remove items.
The two command buttons work fine, but I want to disable the "Add" button once there are 8 items in the list, and disable the "Remove" button if the list is empty.
Here's my code so far;
Private Sub cmdAddItem_Click() Static count As Integer Static name As String count = lstPoints.ListCount count = count + 1 name = "Point " & count lstPoints.AddItem name End Sub Private Sub cmdRemoveItem_Click() Size = lstPoints.ListCount - 1 lstPoints.RemoveItem Size End Sub
I've tried a number of things myself, including an if statement to disable the cmdAddItem button if the size of the list is greater than 8. Also tried a while loop (while size of list is less than 8, enable button, otherwise disable button) but that added all 8 items in the list at the same time.
Any ideas? Thanks