System.Windows.Forms.ListBox.SetSelected Method

Selects or clears the selection for the specified item in a System.Windows.Forms.ListBox.

Syntax

public void SetSelected (int index, bool value)

Parameters

index
The zero-based index of the item in a System.Windows.Forms.ListBox to select or clear the selection for.
value
true to select the specified item; otherwise, false.

Remarks

You can use this property to set the selection of items in a multiple-selection System.Windows.Forms.ListBox. To select an item in a single-selection System.Windows.Forms.ListBox, use the ListBox.SelectedIndex property.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0