manduz_griffus
asked on
Fast loading objects in a DataGridViewComboBoxColumn
Hi,
Im currently having a problem about loading 2000 objects inside a DataGridiewComboBoxColumn. The routin im currently using is very slow. I do a foreach-loop in my collection class, and then add the items one by one. I also tried threading (www.codeproject.com/csharp/workerthread.asp) but the problem is the column reacts very late while the thread is not yet finished and also the AutoComplete of the column does not normally work until the thread stops. Any ideas on how to fast load lots of objects inside a DataGridiewComboBoxColumn? Help!
Im currently having a problem about loading 2000 objects inside a DataGridiewComboBoxColumn.
ASKER
hi JimBrandley,
Sorry for the late reply. I tried what you have suggested, using AddRange, passing an array of the 2000 objects. It is very slighty faster, but is there a faster solution? By the way, i am adding 2000 items to a combobox; a DataGridViewComboBoxCell to be precise. Any more ideas?
Sorry for the late reply. I tried what you have suggested, using AddRange, passing an array of the 2000 objects. It is very slighty faster, but is there a faster solution? By the way, i am adding 2000 items to a combobox; a DataGridViewComboBoxCell to be precise. Any more ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Maybe you're right. It is rather incovenient for the user to select an item in a 2000-item combo box. The problem is this combobox is a DataGridViewComboBoxColumn . It is part of a purchase order form where the DataGridView is where the user selects an item, inputs price, etc. The user can type on the DataGridViewComboBoxColumn since AutoComplete is enabled, so selecting an item is not an issue, loading those items is.
What im planning now is to pre-load an ObjectCollection in the splash screen and when the PO form is loaded, add the ObjectCollection to the DataGridViewColumn.
What im planning now is to pre-load an ObjectCollection in the splash screen and when the PO form is loaded, add the ObjectCollection to the DataGridViewColumn.
This solution is not working for me - I need to display all items in my DataGridViewComboBoxColumn and I have more than 1000 of them. In the ComboBox, there is no problem. So, what to do? The issue was also posted to Microsoft directly, years ago, but nothing happened. I've also tried to change my datasource from data table to string array, with the same slow result. I can create an control by myself, but this will take a lot of time. I guess there some way out of this?
If the former, you might consider implementing paging for your grid - 2000 is a large number of rows.
If the latter, try
comboboxColumn.Items.AddRa
Jim