i have a listbox bound to a dataset and what i would like to do is allow the user to select multiple items from the listbox then loop through the selectedindicies to delete the rows, this is the code thusfar:
it works if up to two are selected, but if there are 3 or more selected i get an error "Index was outside bounds of the array"
any ideas? oh and this is VS 2003 not VS 2005
VB.NET:
For x As Integer = lstContacts.SelectedIndices.Count - 1 To 0 Step -1
DsContactList1.Contacts.Rows(lstContacts.SelectedIndices.Item(x)).Delete()
Next x
it works if up to two are selected, but if there are 3 or more selected i get an error "Index was outside bounds of the array"
any ideas? oh and this is VS 2003 not VS 2005