I have a form named, frmTransaction, that has txtTranNo, txtCustCode, dtbDate, txtRemarks, txtTotalAmount, and has a datagridview named, dtgDetail.
On the dtgDetail, I have columns cTranNo, nLineID, cProductID, nQty, nPrice, and nAmount.
cProductID is a combobox column that has a datamember cProduct and a displaymember cDescription, so that when it is runnning the user will see the product name instead of its product code.
But my product has 2000 records, and when I load my form it is very slow. It is also slow when saving/committing it to my database.
I think the cProduct column has something to do with my form's speed. Is this true? How can I speed it up?
Edit
I can show the code, but it will less confusing if I just explain how my code works. In my design time, my datagridview has empty columns. The name of the datagridview is also the name of the table that will be bound, and when i run it, it creates its column that automatically binds based on the table's schema. I also have a flag that tells the program if the field will be a combobox column or just plain textbox. If it is a combobox column, it will generate an sql script, and run and save the result to a datatable that will be the datasource of the combobox. The datamember and the displaymember of the combobox column are also determined by the flag.
It is advisable that I shouldn't put any condition in my script for the datasource of my combobox column.
Edit - 12-05-12 I try to filter my sql datasource upon binding it to the datagridview combobox column...and I would say that I helps to speed my form. My problem now is when I add new record in my datagridview that is not include in the combobox. For example, I will bind this script to my datagridview, "select ID,Desc from product where ID in (1,2,3,4,5)". When I insert a new record/item/product in my datagridview which is ID = 6, it will not show the description datagridview...