I have encountered an unusual scenario whereby it is impossible to close the form if the focus is set on UltraCombo where LimitToList = True.
The exact scenario is as follows: User tabs into UltraCombo. User decides to discard their changes and close the form (without making a selection in the UltraCombo). Form closure is IMPOSSIBLE.
This is not a problem when the LimitToList = False.
Is there a workaround to this?
Perfect! That solved my problem. Thank you very much.
The control referred to in this thread is the Infragistics.Win.UltraWinGrid.UltraCombo control, which is not the same as the Infragistics.Win.UltraWinEditors.UltraComboEditor control. UltraComboEditor fires an event, ItemNotInList, and its event arguments class exposes a 'RetainFocus' property, so you should be able to handle that event and set RetainFocus to false if the event arguments' InvalidText property is an empty string.
There is not an AllowNull property in my UltraComboEditor!!!! :(
I have received the following response from Infragistics Support:
If you set the LimitToList property of the UltraCombo to true and you will try to close the form having the UltraCombo with null values then it will not allow you to close the Form and it is the expected behavior.
The LimitToList property validates the value that you have put in the UltraCombo box with the value present inside the dropdownlist. If you put some value that is not present inside the dropdownlist then it will not allow you to close the Form until you put the correct value. So, if the combo has null value when you try to close the Form it will check first in combo dropdown list for null value if not found any matching value it will not allow you to close the Form.
If you wish to close the Form when the UltraCombo having null value then only you need to set the UltraCombo's AllowNull property to True. You can set it from designer property window of the UltraCombo. Setting this value to true will allow you to close the Form.
When the form closes, the UltraCombo has to loose focus. When you set the LimitToList = true, in order for the UltraCombo to loose focus a item on the list should be selected. So in the form's Closing event you can select a item from the UltraCombo's list, the validation will succed, and the form is going to be closed.
Emanuel