Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1878
Exception when item is not in list on UltraComboEditor
posted

Hi there,

in our application we have several combos for displaying things like payment method, tax class, credit card type etc. for an Order. In the Order those items are stored with their id (PaymentMethodId, TaxClassId, CreditCardTypeId) as integer values. Some of those combos are UltraCombo, other UltraComboEditor classes. I've set their DropDownStyle to DropDown, the AutoCompleteMode to SuggestAppend. The list of items, the combos are displaying, are fetched from a list of our business objects using MS BindingSource, I've set the DataBindings properties Value, DisplayMember and ValueMember appropriately and that works at it should be.

To prevent entering values that are not in the list of items I've attached an event handler to the ItemNotInList event. In that handler I proceed as you suggested in one of your examples which also works fine.

Now with one of the several UltraComboEditor objects used I've a small problem. I've also subscribed for BindingComplete event on the Order object to check if an error during binding occurs. In this one combo as soon as I enter one single character which never could lead to a valid item of the list the BindingComplete event is fired with a System.FormatException saying that the input string was not in correct format. I can of course suppress this exception but I would like to understand how this could be. From my understanding data is only written back to the Order business object when the UltraComboEditor looses focus which is not the case. I also don't understand why this event gets fired before the ItemIsNotInList event so that I can appropriately react on that. I even registered a Click event on that combo to check before if the item is in the list but also that is not called before the BindingComplete event.

It's strange that I experience this problem just with one UltraComboEditor while other's are working fine although they are all working the same way on the same Order Business Object? When I enter an illegal value in the other combo boxes the event handler for ItemNotInList event gets called and I can react on that appropriately.

Any ideas?

Kind regards,
Wolfgang