Method SetSelected
SetSelected(int, bool)
Selects or clears the selection for the specified item in a ListBox.
public virtual bool SetSelected(int index, bool value)
Parameters
index
intThe zero-based index of the item in a ListBox to select or clear the selection for.
value
booltrue
to select the specified item; otherwise, false.
Returns
Remarks
You can use this property to set the selection of items in a multiple-selection ListBox. To select an item in a single-selection ListBox, use the SelectedIndex property.
Exceptions
- ArgumentOutOfRangeException
The specified index was outside the range of valid values.