windows - DataGridView problem when adding columns -


hey guys! first time use visual studio 2008 windows form application c++.

i want put datagridview on form. ok. when adding 1 column, on gridview appear 2 columns. first no header (which dont want) , second ok(my column). tried set column number code, same thing happens.

any idea solve this?

thanks, andrew

//          // table         //          this->table->allowusertoaddrows = false;         this->table->allowusertodeleterows = false;         this->table->columnheadersheightsizemode = system::windows::forms::datagridviewcolumnheadersheightsizemode::autosize;         this->table->columns->addrange(gcnew cli::array< system::windows::forms::datagridviewcolumn^  >(1) {this->column1});         this->table->location = system::drawing::point(13, 89);         this->table->name = l"table";         this->table->readonly = true;         this->table->size = system::drawing::size(240, 150);         this->table->tabindex = 2;         //          // column1         //          this->column1->headertext = l"column1";         this->column1->name = l"column1";         this->column1->readonly = true; 

are adding column in constructor?

i've had problem in past items added in constructor added twice, because (i think) constructor gets called make control appear in designer view, (which gets added instance) , again when run program.

if what's happening you, need check aren't in design mode.

there few different ways check this, depending on context - see how tell if .net code being run visual studio designer


Comments