views:

10

answers:

2

I've got a subclass of DataGridView that adds all the columns it needs in it's own constructor, but when I use this component in the VS designer it insists on generating code to add the same columns on top of the ones added in the component constructor. How do I force it to not generate code for columns it already finds populated inside a datagridview?

A: 

You need to turn off autogeneration of columns before binding your datasource:

datagridview.AutoGenerateColumns = false;
datagridview.DataSource = mydatasource;
cdkMoose
Sorry, just noticed you said the designer was creating the columns. My answer would be applicable only at binding time.
cdkMoose