0

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?

0

1 Answer 1

0

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

datagridview.AutoGenerateColumns = false;
datagridview.DataSource = mydatasource;
1
  • Sorry, just noticed you said the designer was creating the columns. My answer would be applicable only at binding time.
    – cdkMoose
    Commented Feb 17, 2010 at 17:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.