create contro on tab control

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

Guest

Is it possible to programmatically create a control on one of the pages of a
tab control in a form?

Thanks,
Rocco
 
Rocco,

It should not be a problem. The following code I have in VB.Net - but it is
really pretty similar in Access - please let me know if you have problems:

Dim control As Access._Control ' should be just Control in Access
If createInForm Then
' In Access you will need to use Set in the following line, app - is a
reference to Access.Application object, sectionIndex - is the index of form
section the control is created in:
' parentName should be the name of your tab control
control = app.CreateControl(formName, controlType, sectionIndex,
parentName)
Else 'If createInReport
control = app.CreateReportControl(reportName, controlType, sectionIndex,
parentName)
End If
control.Name = controlName
' then set the rest of the controls properties

HTH
 
rocco said:
Is it possible to programmatically create a control on one of the pages of a
tab control in a form?


Creating controls is strictly a design time operation. You
should not try to do this at run time.

The standard approach is to precreate the control and make
it visible/invisible as needed.
 
Back
Top