property ComboBox.EditText([ColIndex as Variant]) as String

Retrieves or sets a value that indicates the edit's caption for a given column.

 TypeDescription 
   ColIndex as Variant A long expression that indicates the column's index, or a string expression that indicates the column's caption or column's key. If -1, the EditText property accesses the text in the FilterFor field.   
   String A string expression that indicates the text in the column's edit box.  

The EditText property gets the text inside the column's edit box. If the SingleEdit property is True, then the SearchColumnIndex determines the index of the edit control that is displayed in the control. When the AutoComplete property is True, the text for each edit control is automatically updated with the values of the cells of the selected item. To find out the selected item you can call SelectedItem property of Items object. If the user has altered one of the control edit controls it fires the EditChange event. The EditText property is valid only if the control's Style property is not DropDownList. Use the AssignEditImageOnSelect property to display the cell's icon when user selects a new item. Use the Value property to get or set the selected value, when the control contains a single column. Use the Select property to get or set the selected value when control contains multiple columns. Use the AutoSearch property to disable incremental search feature in the control.

The following VB sample changes the control's s edit portion when the user clicks a button:

With ComboBox1
    Dim bSearch As Boolean
    bSearch = .AutoSearch
    .AutoSearch = False
    Dim bAutoComplete As Boolean
    bAutoComplete = .AutoComplete
    .AutoComplete = True
    .EditText = "test"
    .AutoSearch = bSearch
    .AutoComplete = bAutoComplete
End With

The following C++ sample changes the control's s edit portion when the user clicks a button:

BOOL bSearch = m_combobox.GetAutoSearch(), bAutoComplete = m_combobox.GetAutoComplete();
m_combobox.SetAutoComplete( TRUE );
m_combobox.SetAutoSearch( FALSE );
m_combobox.SetEditText( COleVariant( long(0) ), "test" );
m_combobox.SetAutoSearch( bSearch );
m_combobox.SetAutoComplete( bAutoComplete );

The following VB.NET sample changes the control's s edit portion when the user clicks a button:

With AxComboBox1
    Dim bSearch As Boolean = .AutoSearch
    .AutoSearch = False
    Dim bAutoComplete As Boolean = .AutoComplete
    .AutoComplete = True
    .set_EditText("test")
    .AutoSearch = bSearch
    .AutoComplete = bAutoComplete
End With

The following C# sample changes the control's s edit portion when the user clicks a button:

Boolean bSearch = axComboBox1.AutoSearch;
axComboBox1.AutoSearch = false;
Boolean bAutoComplete  = axComboBox1.AutoComplete;
axComboBox1.AutoComplete = true;
axComboBox1.set_EditText("test");
axComboBox1.AutoSearch = bSearch;
axComboBox1.AutoComplete = bAutoComplete;

The following VFP sample changes the control's s edit portion when the user clicks a button:

With thisform.ComboBox1
    local bSearch, bAutoComplete
    bSearch = .AutoSearch
    .AutoSearch = .f.
    bAutoComplete = .AutoComplete
    .AutoComplete = .t.
    .EditText(0) = "test"
    .AutoSearch = bSearch
    .AutoComplete = bAutoComplete
EndWith

 


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