You can't modify a collection that is enumerated with 'for each'. Otherwise you might end up retrieving objects that no longer exist, exactly what you are doing now. What you can do, however, is the following:
Code:
For Each Object o In _
From Object x In History_TextBox.SelectedItems _
OrderBy History_TextBox.Items.IndexOf(x) Descending _
Select x
History_TextBox.Items.Remove(o)
Next
Or alternatively:
Code:
For i As Integer = History_TextBox.SelectedIndices.Count - 1 To 0 Step -1
History_TextBox.Items.RemoveAt(History_TextBox.SelectedIndices(i))
Next
One is LINQ, the other is reverse looping through indices. In order to ensure that the indices remain the same, you must remove items from the back to the front.