由于一个奇怪的原因,我无法删除我在ListBox上的最后一个列表选择项。其他所有工作都很完美,我可以删除列表框上列表选择的索引,但不能删除列表框中最后一个索引。
以下是我的删除方法:
我的DeleteButton:
'This is the Deletebutton event handler. It first checks that an index has
'been selected before deleting
Private Sub btnRemove_Click(sender As Object, e As EventArgs) Handles btnRemove.Click
If (CheckSelectedIndex()) Then
Dim list = listResults.SelectedIndex
m_contacts.DeleteContact(list)
UpdateGUI()
End If
End Sub
我在ContactManager类中的删除方法。
'This is the DeleteContact. It has index as parameter and simply removes a
'contactRegistry at the given index.
Public Sub DeleteContact(index As Integer)
m_contactRegistry.RemoveAt(index)
End Sub
它可能与索引有关,但我找不到问题..