What is this->Controls->Add(color);?
What will happen if code below is without this->Controls->Add(color);?
What is the result from the code this->Controls->Add(color);?

color=new Button();
color->Text="Ok";
color->Top=320;
color->Left=420;
this->Controls->Add(color);

What is this->Controls->Add(color);?
What will happen if code below is without this->Controls->Add(color);?
What is the result from the code this->Controls->Add(color);?

This statement actually adds the button you have created to the set of controls(buttons, listboxes, etc) that are associate with your window. Without it you won't have access to this control on your form, in effect your button won't exist at all. The result is you have a "color" button on your form to do whatever a color button does.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.