property Items.SelectItem(Item as HITEM) as Boolean

Selects or unselects a specific item.

 TypeDescription 
   Item as HITEM A long expression that indicates the handle of the item being selected or un-selected.  
   Boolean A boolean expression that indicates the item's state. True if the item is selected, and False if the item is not selected.  

The SelectItem property selects an item. The control selects only selectable items. The SelectableItem property specifies whether the user can select an item. Use the SelectedItem property to retrieve the selected item.  Use the Select property to select an item given a value on a specified column. Use the Value property to select an item given its value on a single column control. Use the ItemByIndex property to access an item given its index. The control fires the SelectionChanged event when user selects an item. Use the SelForeColor and SelBackColor properties to specify colors for selected items.

The following VB sample selects the first visible item:

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

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

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

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

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

The following C# sample selects the first visible item:

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

The following VFP sample selects the first visible item:

with thisform.ComboBox1.Items
	.DefaultItem = .FirstVisibleItem
	.SelectItem(0) = .t.
endwith

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.