Hi all,
I have a combobox on a userform where I would like the user to have the ability to add or delete items. To delete an item, I would like for the user to be able to select an item in the list and then click a [-] delete button. The problem that I'm experiencing is that .listindex = 0 when the first item is selected, but also when nothing is selected. How can I distinguish between the two situations to prevent the first item from being deleted when, in fact, nothing has been selected?
The If ... Exit Sub line, in the code below, prevents the first item from being deleted when nothing is selected. But, also prevents the first item from being deleted altogether.
Thanks!PHP Code:
Private Sub RemoveTagButton_Click()
If Me.ListBoxTags.ListIndex <= 0 Then Exit Sub
Me.ListBoxTags.RemoveItem (Me.ListBoxTags.ListIndex)
End Sub
Bookmarks