DataGridView automatically adding columns I don't want !!?!<p>Hello - </p> <p> </p> <p>I'm sure this is something simple, but I've got a databound DataGridView where I have several columns from the data source and some unbound columns like buttons and so forth.  The problem is that every time I go to make simple changes through the column editor, I see that VS 2005 has added ALL the columns from the datasource to the grid - even columns that I already had in there.  While its not a problem to remove the additional columns, I'd sure like to know if there was a way to prevent VS 2005 from doing this seemingly every time.</p> <p> </p> <p>Thanks,</p> <p> </p> <p>Jeff Balcerzak</p>© 2009 Microsoft Corporation. All rights reserved.Thu, 11 Dec 2008 01:20:31 Zf81350c5-f18e-41a6-8e08-6f5fd9d8cabehttp://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f81350c5-f18e-41a6-8e08-6f5fd9d8cabe#f81350c5-f18e-41a6-8e08-6f5fd9d8cabehttp://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f81350c5-f18e-41a6-8e08-6f5fd9d8cabe#f81350c5-f18e-41a6-8e08-6f5fd9d8cabeJBalcerzakhttp://social.msdn.microsoft.com/Profile/en-US/?user=JBalcerzakDataGridView automatically adding columns I don't want !!?!<p>Hello - </p> <p> </p> <p>I'm sure this is something simple, but I've got a databound DataGridView where I have several columns from the data source and some unbound columns like buttons and so forth.  The problem is that every time I go to make simple changes through the column editor, I see that VS 2005 has added ALL the columns from the datasource to the grid - even columns that I already had in there.  While its not a problem to remove the additional columns, I'd sure like to know if there was a way to prevent VS 2005 from doing this seemingly every time.</p> <p> </p> <p>Thanks,</p> <p> </p> <p>Jeff Balcerzak</p>Fri, 04 May 2007 15:11:01 Z2007-05-10T13:01:40Zhttp://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f81350c5-f18e-41a6-8e08-6f5fd9d8cabe#d45eeb19-46e9-4815-ab69-05c5a76124f2http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f81350c5-f18e-41a6-8e08-6f5fd9d8cabe#d45eeb19-46e9-4815-ab69-05c5a76124f2timvwhttp://social.msdn.microsoft.com/Profile/en-US/?user=timvwDataGridView automatically adding columns I don't want !!?!Clear the DataSource property.. And in the constructor of your form set this.dataGridView.AutoGenerateColumns = false;<br>Fri, 04 May 2007 15:16:22 Z2007-05-04T15:16:22Zhttp://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f81350c5-f18e-41a6-8e08-6f5fd9d8cabe#20f49d47-300b-4fcd-bea4-13313b002b28http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f81350c5-f18e-41a6-8e08-6f5fd9d8cabe#20f49d47-300b-4fcd-bea4-13313b002b28JBalcerzakhttp://social.msdn.microsoft.com/Profile/en-US/?user=JBalcerzakDataGridView automatically adding columns I don't want !!?!If I clear my data source, won't I lose the columns I already have defined?  You'd think that auto create columns property would be visible at design time...Fri, 04 May 2007 16:09:11 Z2007-05-04T16:09:11Zhttp://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f81350c5-f18e-41a6-8e08-6f5fd9d8cabe#e3f4d2a1-83f6-4964-917f-9fbd321e2927http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/f81350c5-f18e-41a6-8e08-6f5fd9d8cabe#e3f4d2a1-83f6-4964-917f-9fbd321e2927timvwhttp://social.msdn.microsoft.com/Profile/en-US/?user=timvwDataGridView automatically adding columns I don't want !!?!Well, i just tried it:<br><br>- The columns that where added by the designer disappear<br>- The columns that you added manually remain (and if you set their datapropertyname to a property that existed on the datasource this datapropertyname remains too)<br><br>Fri, 04 May 2007 18:51:20 Z2007-05-10T13:01:40Z