Рассмотрим следующий код:Индекс вне диапазона в ListBox VB.NET
Private Sub DelButton_Click(sender As Object, e As EventArgs) Handles DelButton.Click
If OrderListBox.Text = "" = False Then
For i As Integer = OrderListBox.SelectedIndex To arr.Count - 1
arr.RemoveAt(i)
Next
OrderListBox.Items.Remove(OrderListBox.SelectedItem)
End If
calculate()
End Sub
программа падает на arr.RemoveAt(i)
и выводит следующее сообщение об ошибке:
Index was out of range. Must be non-negative and less than the size of the collection.
, что вы имеете в виду можете ли вы объясните больше пожалуйста @HenkHolterman –