property Items.SelectItem(Index as Long) as Boolean
Selects or unselects a specific item.

TypeDescription
Index as Long A long expression that indicates the index of the item.
Boolean A boolean expression that indicates whether the item is selected or unselected.
The control supports single or multiple selection. Use the SelectItem property to select or unselect programmatically an item. Use the SelectCount and SelectedItem properties to enumerate the collection of selected items. The SelectionChanged event is fired when the user changes the selection. Use the SelForeColor and SelBackColor properties to specify colors for selected items. Use the SingleSel property of the control to allow multiple selection. If the control supports only single selection ( SingleSel property is True ), the FocusItem retrieves the selected item too. Use the Caption property to specify the cell's caption. Use the SelectAll method to select all items in the list. Use the UnselectAll method to unselect all items in the list.

The following VB sample selects the first visible item:

With List1.Items
    .SelectItem(.FirstVisibleItem) = True
End With

The following VB sample selects all items in the list:

With List1
    .BeginUpdate
    With .Items
        For i = 0 To .Count - 1
            .SelectItem(i) = True
        Next
    End With
    .EndUpdate
End With

The following C++ sample selects the first visible item:

#include "Items.h"
CItems items = m_list.GetItems();
items.SetSelectItem( items.GetFirstVisibleItem(), TRUE );

The following VB.NET sample selects the first visible item:

With AxList1.Items
    .SelectItem(.FirstVisibleItem) = True
End With

The following C# sample selects the first visible item:

axList1.Items.set_SelectItem(axList1.Items.FirstVisibleItem, true);

The following VFP sample selects the first visible item:

with thisform.List1.Items
	.SelectItem(.FirstVisibleItem) = .t.
endwith