Adding a control to ControlCollection.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having trouble adding a control to ControlCollection in a class I have derived from GroupBox. Here is what I've got

__gc class RowColumn : public System::Windows::Forms::GroupBo

public
RowColumn()
ignoredcontrols = new System::Windows::Forms::Control::ControlCollection(this)


void IgnoreControl(System::Windows::Forms::Control* control)
ignoredcontrols->Add(control)


void DoSomething()
int i
for(i=0; i < ignoredcontrols->Count; i++)
/*...*



private

System::Windows::Forms::Control::ControlCollection* ignoredcontrols
}

When I call RowColumn::IgnoreControl() the control isn't added to my collection. I checked in the debugger and ignoredcontrols->Count is 0 and ignoredcontrols->ReadOnly is false. There is no exception through, it just doesn't add the control. Any ideas why this doesn't work?
 
Back
Top