Autocomplete - Append and getting only the text the user has inputed on combobox

I have a ComboBox that I set up like this:

this.cmbCustomerJob.DisplayMember = "display";
this.cmbCustomerJob.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
this.cmbCustomerJob.AutoCompleteSource = AutoCompleteSource.ListItems;
this.cmbCustomerJob.DropDownStyle = ComboBoxStyle.DropDown;

However I'm messing with the KeyPressed event to prevent the user from entering a new term into the ComboBox, however when I do cmbCustomerJob.Text it returns even the suggested portion, how can I get only what the user has typed?

11.12.2008 17:49:43
1 ОТВЕТ
РЕШЕНИЕ

I found the answer, I did this:

strNew = ((ComboBox)sender).Text.Substring(0, ((ComboBox)sender).SelectionStart) + c.ToString();

It grabs the Text from the start (0) to were the selection begins (SelectionStart), the c.ToString() is the KeyPressEventArgs.KeyChar

1
9.11.2017 13:33:41