hi i want to bind data form data set into datagird view columns but i can't is there some one to help me pleaaaaaaaaaaaaaaaasssssssssssssssssseeeee

1st do not create any columns for dgv!
They will be created automatically when binding data.

Then use this code:

dataGridView1.DataSource = new BindingSource(ds.Tables[0], null);
//ds is a reference of dataSet, while Tables[0] is the 1st dataTable from DataSet.
//if you have more then one dataTable, if you want to bind 2nd table, then do: Tables[1]!

thank's for your help but its not my problem those are my codes please see it if you have time and resolve my problem

con = new SqlConnection(MC.StrCon);
strSql = "Select * from Anb_Tbl_Anbar";
da = new SqlDataAdapter(strSql,con);
this line is my problem ----> dataGrid_Tbl_Anbar.DataBindings.Add("Columns[<1>].clm",ds,"Anb_Tbl_Anbar.Anb_Fld_AnbarCode"); <-------
i can fill the data gird view easily but i want to fill in special columns that i created before please help me

Edited 4 Years Ago by ali.alipanahi: n/a

This article has been dead for over six months. Start a new discussion instead.