I would like to respond to ValueChanged, except I don't want to respond to it when the user is typing in the combo and the combo is autocompleting. So basically, I'd like to do something when the user opens the combo and makes a selection with the mouse or if they open the combo, use the arrow keys and then press <enter>. I DON'T want to react if the dropdown is open, but the user is typing into the textbox portion and the control is autocompleting.
Is there an event or property I can use to make this easier?
I think you want to just set UltraCombo.AutoCompleteMode = SuggestAppend (2008.2 and later). While the user is typing, the edit portion is auto-completed, and the dropdown's contents are filtered, but the ValueChanged event does not fire until an item is selected.
I don't think I fully thought through the original question. Here's what I'm trying to do: I have a window with a buncha customer related information. When the user selects a customer from the customer combo, I want to fill in the other fields. Unfortunately, this will require a trip to the db. If I do this on ValueChanged, then if a user is a fast typist, as he's typing away and autocomplete is going off, I'll be hammering away at the db quite a bit before he arrives at the customer he wants.
Right now I'm doing something with a timer that "waits" for the user to finish typing before checking to see if there's a new customer selected, and then it raises an event. This event also gets raised when the user makes a selection from when the combo is opened.
I'm not certain that I followed this, but the control exposes an 'IsDroppedDown' property, so you can use that to know whether the dropdown is open. When the character typed by the end user causes a match to be made, i.e., the control auto-completes the value, the control's SelectedRow property will be non-null when the typed character was auto-completed.
Example:void OnValueChanged(object sender, EventArgs e){ UltraCombo ultraCombo = sender as UltraCombo; bool wasAutoCompleted = ultraCombo != null && ultraCombo.IsDroppedDown == false && ultraCombo.SelectedRow != null;}
Note that this is not airtightyet, as it doesn't catch the condition whereby the up/down arrow key was used to change the value, but you could probably hack around that by handling KeyDown, KeyPress, etc. If I missed the point here please repost and we will try to help.
I don't know of any easy way to distinguish this.