AutoGenerateColumns= false not working

I am able to set up my datagridview fine.  I use
DgvCalls.AutoGenerateColumns = false;
so that I can programmatically add columns.  The column that I added works fine, however the columns of the datasource are still coming up.  what am I doing wrong?  Below is my code.

//parent table

DaCustomers = new SqlDataAdapter("select * from Customers", conn);

DaCustomers.Fill(data, "Customers");

//child table

DaCalls = new SqlDataAdapter("select * from Calls", conn);

DaCalls.Fill(data, "Calls");

//table with look up values to use in datagridview later

DaTblLkUp = new SqlDataAdapter("select * from tblLkUP", conn);

DaTblLkUp.Fill(data, "tblLkUp");


DataRelation relation = new DataRelation(" CustomersCalls",





BindSourceCustomers.DataSource = data;

BindSourceCustomers.DataMember = "Customers";

//BindSource2 relation in tables

BindSourceCalls.DataSource = BindSourceCustomers;

BindSourceCalls.DataMember = "CustomersCalls";

//DataGridView shows the related values of the parent table

DgvCalls.DataSource = BindSourceCalls;

DgvCalls.AutoGenerateColumns = false;

//Set up Column with the look up value

One of the colums is called RsnCall.  The main table stores 1, 2, 3 ,4....the second table stores the values to the codes "get info", "appointment", ect

DataGridViewComboBoxColumn Col1 = new DataGridViewComboBoxColumn();

Col1.HeaderText = "Reason Call";

Col1.DataPropertyName = "RsnCall";

Col1.DataSource = data1;

Col1.DisplayMember = "tblLkUp.Name_Lk";

Col1.ValueMember = "tblLkUp.ID_Lk";

Col1.FlatStyle = FlatStyle.Flat;

DgvCalls.Columns.Insert(1, Col1);

What am I doing wrong????
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


I tried your way and it's true, but try to invert your two lines:

DgvCalls.AutoGenerateColumns = false;
DgvCalls.DataSource = BindSourceCalls;

Worked on mine!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
yanci1179Author Commented:
thanks, switched the lines and it worked!!  Do you know why?  Thanks alot!!
Well, in .Net 2.0, it autibinds your DataSource, since the property is at true before then..

Thanks for the points
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.