This documentation is archived and is not being maintained.

ListViewItem.Selected Property

Gets or sets a value indicating whether the item is selected.

[Visual Basic]
Public Property Selected As Boolean
public bool Selected {get; set;}
public: __property bool get_Selected();
public: __property void set_Selected(bool);
public function get Selected() : Boolean;
public function set Selected(Boolean);

Property Value

true if the item is selected; otherwise, false.


If the MultiSelect property of the ListView control the item is contained in is set to true, setting the value of this property adds or removes the item from the set of selected items; if the MultiSelect property is set to false, setting the value of this property to select an item automatically cancels the selection for any other items in the ListView control. You can use this property to determine if an item is selected or to select an item at run time. You can access all items that are selected in a ListView control by using the ListView.SelectedItems property.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

ListViewItem Class | ListViewItem Members | System.Windows.Forms Namespace | SelectedItems | SelectedIndices