Create controls dynamically on a specific page of a tab control

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

Guest

Hi all,
I am trying to create a control on a specific page of a tab control, I don’t
know how
to link the created control (using createcontrol() function) to the
appropriate page of the tab control. Any hint would be helpful.
Thanks,
Robert A. Broomandan
 
Robert A. Broomandan said:
I am trying to create a control on a specific page of a tab control, I don’t
know how
to link the created control (using createcontrol() function) to the
appropriate page of the tab control. Any hint would be helpful.


I think you have to add the control to the tab control's
Controls collection.

Be aware that this is only a good idea if you are creating a
wizard to help you in your form design process.
CreateControl should never be used at run time in response
to a data value or a user action. Far better to have the
control already on the form/tab control and just make it
visible/invisible as needed.
 
Marshall,
I added the tab control's page name as the parent argument of the
createobject() and it worked fine. Thank you for the hint.
Meanwhile, I'd like to explain you how the application works. Based on user
selection at run-time, appliaction needs to open a form to represent the data
(for instance an individual info.) application opens the form (an empty
template form) in design mode adds the appropriate controls (table driven
control's info.) saves and closes the form and then open it in normal view.
I'd be glad to know what's the cons of this approach?
Thanks,
Robert A. Broomandan
 
The cons to this approach are numerous and serious. First
and foremost is that you open door more than a little to
database corruption. Creating/editing large objects such as
forms or reports is a major operation and if anything goes
wrong, you will have no way to immediately recognize the
problem. While this is a major irritation during design
time operations, at least you had the oportunity to make
backups and you should be able to recognize the issue fairly
quickly.

Another con is that this kind of operation causes major
database bloat that will increase the maintenace issues of
the front end. Yes, you can set the front end DB's Compact
on Close option, but now you're invoking another heavy duty
operation, compounding the original problems. The Compact
operation is pretty stable, but you should make a backup
before doing it just in case.

A killer con that may or may not be important to you is that
you can not use this approach at all in an MDE.

Besides all that, it's actually easier to maipulate a pool
of invsible controls than it is to create new ones.
 
Back
Top