Hi, I am able to get the index of items added to the BindingList. When I try to get the index if the deleted item I get the error
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Here is my code
Private Sub cmdRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRemove.Click
For i As Integer = 0 To _assignedSelection.SelectedCount - 1
Dim item As Jurisdiction = CType(_assignedSelection.GetSelectedRow(i), Jurisdiction)
_list.Remove(item)
Next
End Sub
Private Sub list_Change(ByVal sender As Object, ByVal e As ListChangedEventArgs) Handles _list.ListChanged
If (_list.Count > 0) Then
Select Case e.ListChangedType
Case ListChangedType.ItemAdded
_dal.InsertJurisdiction(_list.Item(e.NewIndex))
Case ListChangedType.ItemDeleted
'MsgBox(e.NewIndex.ToString)
_dal.DeleteJurisdiction(_list.Item(e.NewIndex)) <--------HERE
End Select
End If
End Sub
EDIT: Answers in C# are also welcome....anyone?