Adding a control to ControlCollection.

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top