Hi Gil,
I am afraid, we do not have any equivalent API in the ComboBoxAutoComplete control for the ComboBox''s SelectedIndex property. Note that the ComboBoxAutoComplete is not exactly a ComboBox and the items in its dropdown are intended for auto-completion purposes only (and not to get/set values or indices).
However, as a workaround you could derive from the ComboBoxAutoComplete and implement a SelectedIndex property as shown below :
public class CustomComboBoxAutoComplete : ComboBoxAutoComplete
{
int matchcol = -1;
public CustomComboBoxAutoComplete() : base() {}
public int SelectedIndex
{
set
{
for(int i=0; i< this.AutoCompleteControl.Columns.Count; i++)
{
if (this.AutoCompleteControl.Columns[i].MatchingColumn == true)
{ matchcol = i;
break;
}
}
DataTable table = this.AutoCompleteControl.TableData;
if (this.matchcol != -1)
this.Text = table.Rows[value][matchcol].ToString();
else
MessageBox.Show("Invalid Index!");
}
}
}
Please refer to the
test sample that illustrates the above workaround and let me know if this meets your requirements. We appreciate your cooperation and understanding on this issue.
Regards,
Guru Patwal
Syncfusion,Inc.