Click here to Skip to main content
15,918,108 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI friends this is surendra babu. i am very new to vb.net.
in a project i am using datagrid view for billing and i have a combobox in datagrid and binded a table to it, all works fine but the table which i have binded has 9000 rows(entries) so when ever i click on combobox it take 10 to 15 second to load that table. i want fast access for that table. i am thinking of binding that table at form load. so please help me on this its urgent.


I have filled the combobox in datagrid and provide code the code is
Public Class frmOrders
Dim cb As ComboBox
Private Sub OrdersBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrdersBindingNavigatorSaveItem.Click
Me.Validate()
Me.OrdersBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.OrderDataSet)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'CustomerDataSet.Customers' table. You can move, or remove it, as needed.
Me.CustomersTableAdapter.Fill(Me.CustomerDataSet.Customers)
'TODO: This line of code loads data into the 'ProductDataSet.Products' table. You can move, or remove it, as needed.
Me.ProductsTableAdapter.Fill(Me.ProductDataSet.Products)
'TODO: This line of code loads data into the 'OrderDataSet.Order_Details' table. You can move, or remove it, as needed.
Me.Order_DetailsTableAdapter.Fill(Me.OrderDataSet.Order_Details)
'TODO: This line of code loads data into the 'OrderDataSet.Orders' table. You can move, or remove it, as needed.
Me.OrdersTableAdapter.Fill(Me.OrderDataSet.Orders)
End Sub
Private Sub Order_DetailsDataGridView_CellLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Order_DetailsDataGridView.CellLeave
If Not cb Is Nothing Then
cb.SelectedIndex = cb.FindStringExact(cb.Text)
End If
End Sub
Private Sub Order_DetailsDataGridView_EditingControlShowing(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles Order_DetailsDataGridView.EditingControlShowing
If TypeOf e.Control Is ComboBox Then
cb = e.Control
cb.DropDownStyle = ComboBoxStyle.DropDown
cb.AutoCompleteMode = AutoCompleteMode.SuggestAppend
cb.AutoCompleteSource = AutoCompleteSource.ListItems
End If
End Sub
End Class
all working fine. but the thing is, i have 9000 products in database product table when i click on
combo box in datagrid view it is taking 5 to 10 seconds to show list. but same product table when i use it on normal combo box its is super fast i mean it will access in less then 1 second. so please friends help me on this. thanks for u r response on previous solution.

Thank's in advance :rose::rose::rose:
Posted
Updated 7-Mar-11 5:41am
v2
Comments
Sunasara Imdadhusen 24-Feb-11 0:02am    
I could you fill combobox in DataGrid? Please provide snippet of code for filling Combo!

1 solution

Make sure that you fetch your data before the user clicks on the query.
In this way, the time it takes to display the combo is just for client side processing (and not for a call to the database server everytime the user clicks on it).
 
Share this answer
 
Comments
surendrababu18 24-Feb-11 12:27pm    
As i said you i am noob(still learner), so please can u explain me the steps to do that and if any coding to do that.

Thank's for u r response
Your's
Surendra.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900