I am using an UltraComboEditor that is bound to BindingSource this is in turn bound to a DataTable in a DataSet. In some situations my application needs to insert 4000 - 5000 rows into the underlying data table. When I don't have any controls bound to the data table the row inserts occurs in well less then .1 second. With just the UltraComboEditor bound (via the binding source) the row inserts take multiple minutes. My code calls the SuspendBinding method on the binding source and sets the RaiseListChangeEvents property to false but that has no impact. Also, calling the UltraComboEditor's BeginUpdate method before inserting rows doesn't have a significant impact. When I break all in the debugger I can see from the call stack that a CurrencyManager is raising an OnItemChanged event which an Infragistics.Win.BindableValueList is subscribed. Is there anything else I can do to keep the UltraComboEditor from updating for every row insert?
The easiest thing that comes to mind is to set the UltraComboEditor's DataSource to null before inerting the rows, then set it back after the population is complete.
That was my first thought also since I didn't find any method like the UltraGrid's SuspendRowSynchronization method on the UltraComboEditor. So I had tried it before posting on the forum. Unfortunately that didn't take care of all the problems. I called the combo editor's SetDataBinding method with arguments of null and string.empty. But, when a row is added to the underlying data an ArgumentOutOfRangeException is thrown. The exception is caught and handled at a lower level but I don't want to release an application that is throwing thousands of exceptions. Just to make sure that the UltraComboEditor is involved in the exception I commented out the line of code that initially binds the editor to the BindingSource and everything runs fine.
In case it is helpful, listed below are the last few entries in the call stack when the exception is thrown.
mscorlib.dll!System.Collections.ArrayList.this[int].get(int index) + 0x74 bytes Infragistics2.Shared.v8.3.dll!Infragistics.Shared.DisposableObjectCollectionBase.GetItem(int index = 204) + 0x30 bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.ValueListItemsCollection.this[int].get(int index = 204) + 0x2d bytes Infragistics2.Win.v8.3.dll!Infragistics.Win.BindableValueList.OnBindingListChanged(object sender = {System.Windows.Forms.BindingSource}, System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x86 bytes [Native to Managed Transition] [Managed to Native Transition] System.Windows.Forms.dll!System.Windows.Forms.BindingSource.OnListChanged(System.ComponentModel.ListChangedEventArgs e) + 0x7e bytes System.Windows.Forms.dll!System.Windows.Forms.BindingSource.InnerList_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) + 0x2e bytes System.Data.dll!System.Data.DataView.OnListChanged(System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x14e bytes
It would seem that setting the combo editor's data source to null doesn't cause it to unsubscribe to all the events from its original data source???
After playing with it further today I found that if I set the BindingSource.DataSource to null everything works fine. That will work OK for my application as the combo was the only control using this binding source.