property ComboBox.Select(ColIndex as Variant) as Variant
Finds and selects an item given data on the column.

 TypeDescription 
   ColIndex as Variant A long expression that defines the column's index, or a string expression that defines the column's key or caption.  
   Variant A variant value being searched.  

Use the Select property to select a value in the control, if it contains multiple columns. The control selects only selectable items. The SelectableItem property specifies whether the user can select an item. The control looks for the value in the given column. If the value is found in the column, no error is fired. Use the Value property to select a value in a single column control. The SelectCount property specifies if the control has selected items. Use the SelectItem property to select an item given its handle. The SelectionChanged event is fired when user changes the control's selection. Use the ItemByIndex property to access an item given its index. 

The following VB sample selects the "Cell 4" value on the second column:

With ComboBox1
    .BeginUpdate
        .HeaderVisible = False
        .ColumnAutoResize = True
        .Columns.Add "Column 1"
        .Columns.Add "Column 2"
        With .Items
            Dim h As HITEM
                h = .AddItem("Cell 1")
                .CellCaption(h, 1) = "Cell 2"
                h = .AddItem("Cell 3")
                .CellCaption(h, 1) = "Cell 4"
        End With
        .Select("Column 2") = "Cell 4"
    .EndUpdate
End With

The following VB sample displays the selected item, using the Select property:

With ComboBox1
    Debug.Print .Select(.SearchColumnIndex)
End With

The following C++ sample displays the selected item, using the Select property:

OutputDebugString( m_combobox.GetEditText( COleVariant(m_combobox.GetSearchColumnIndex() ) ) );

The following VB.NET sample displays the selected item, using the Select property:

With AxComboBox1
    Debug.WriteLine(.get_Select(.SearchColumnIndex))
End With

The following C# sample displays the selected item, using the Select property:

System.Diagnostics.Debug.WriteLine(axComboBox1.get_Select(axComboBox1.SearchColumnIndex));

The following VFP sample displays the selected item, using the Select property:

With thisform.ComboBox1
	wait window nowait .Object.Select(.SearchColumnIndex())
EndWith
 

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