I have been searching for quite a while to no avail for this answer, and was hoping that someone may have the answer here.

I'm not new to c++; I have been working with it for about 3 years now, and recently moved into visual c++ (with Microsoft Visual Studio 2008), where I quickly ran into a problem I have yet to answer.

My question seems easy enough; is it possible to create objects (such as labels or picture boxes) on the fly from within functions, rather than in the namespace constructor?
I know the general creation code defined with the handles/pointers in the beginning of the form's namespace, but I'm wondering if - through a function - it is possible to create and destroy them?
And if so, what is the proper syntax, and how would I be able to - if at all possible - port it over to an external .cpp file?

Considering the diversity of the C++ language, I believe that the answer to my problems exist, but I have yet to find out precisely what it is.


Any potential help would be appreciated.