Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i found on microsoft website
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagrid.setdatabinding(v=vs.110).aspx[^]

i would like to use like this

dataAdapter.Fill(ds,"article");
dgDetails.SetDataBinding(ds,"article");


but i can't find SetDataBinding method on my computer why?

i use visual studio 2010
Posted

1 solution

Hi,

Please make sure that u r using DataGrid COntrol instead of DataGridView Control..

if u r using DataGrid COntrol , below is the code..

C#
<pre lang="c#">
 System.Windows.Forms.DataGrid dgDetails = new DataGrid();
            dataAdapter.Fill(ds, "article");
            dgDetails.SetDataBinding(ds, "article");


if u using DataGridView control , then below is the code..
dgDetails.DataSource = ds.Tables["article"];

</pre>
 
Share this answer
 
Comments
Thien Duy 21-Apr-20 2:13am    
Thank you very much, Karthik_Mahalingam!
I have just code C# for a little time.
You guide help me to save a lot!
Karthik_Mahalingam 30-Dec-22 1:24am    
welcom

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