1. Add following namespace at the top of the page -
2. Create list of ListItem inside your function
List lstSelected = new List;
3. Loop through the ListBox's Items collection say ListBox Name is "lstboxTest" and add selected list item in List.
foreach (ListItem liItems in lstboxTest.Items)
if (liItems.Selected == true)
4. Now loop through list of selected items lstSelected and remove all ListItem from ListBox that are in lstSelected.
foreach (ListItem liSelected in lstSelected)