I have a listbox for entering phone numbers (lbxPhone). The UI gives the user the ability to remove items from the listbox (single-select) by selecting a phone number and clicking the Remove Button (btnRemovePhone).
The problem is that no matter what selection is made, the item at index zero is removed. Here is the code for btnRemovePhone:
Code:
Protected Sub btnRemovePhone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemovePhone.Click
lbxPhone.Items.RemoveAt(lbxPhone.SelectedIndex)
End If
lbxPhone.SelectedIndex always returns zero. How can I get it to return that actually index of the selected item? What am I missing here?