Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two queries :
1)Can we bind the datagridview to datatable without using "for loop"?
Or is their any easy method.

2)When i bind the datagridview with datatable in the background worker the application hangs. Is their a alternative way of using datagridview, datatable in background worker?
Posted
Comments
tanweer 4-May-12 0:53am    
please post your code block where you are binding the GridView so that we can give you any suitable solution.

1 solution

Hi For Q1.
If I understood properly, why u r using for loop for data binding?
If you use For Loop then it is data filling not binding.
simply try the following code.

VB
DataGridView1.DataSource = DataTable1


For Q2.

If you are doing thing in background worker then you have to invoke the controls of parent thread and then do what ever you want.
If you need any example code try searching in msdn.
 
Share this answer
 
Comments
Maciej Los 4-May-12 3:22am    
Good answer, My 5!
Manoj K Bhoir 4-May-12 8:37am    
Small and Correct, My 5!

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