How to add a control from code at runtime?

  • Thread starter Thread starter Stephane Saindon
  • Start date Start date
S

Stephane Saindon

Is it possible to add a control to a form from code at runtime?

I read VisualBasic would allow the me.controls.add method, but it doesn't
seems to be allowed in Access2000. Is it true? Any alternative?

Thx
 
Stephane said:
Is it possible to add a control to a form from code at runtime?

I read VisualBasic would allow the me.controls.add method, but it doesn't
seems to be allowed in Access2000. Is it true? Any alternative?


No, it's not possible. It is possible to switch to design
view, use CreateControl, and reopen the form, but it a very
very BAD idea to do this in a running application.

The standard (and easier) way to do what I think you want is
to precreate a pool of invisible controls and then you can
make them visible as needed at runtime.
 
That was my fear.... but thx very much anyway,

It's actually my other post, but if don't mind I ask you in in here.....
Is it possible to create a control class within Access2000? (for example
using the textbox to make a new textbox control that validate the
data)
 
Stephane said:
That was my fear.... but thx very much anyway,

Why would you fear that? The invisible control pool is much
better, it's faster and less complex as well as a better
programming practice.

It's actually my other post, but if don't mind I ask you in in here.....

data)

Sorry, but I don't understand what you're trying to do with
this.
--
Marsh
MVP [MS Access]


 
Well I want to create a custom variant of the treeview that would be my
standard
filter selection box for reports and query. Wanted to create either a custom
control
based on treeview (don't see how to do it within Access) or do a standard
class that
would bring up it's own treeview on the target form. Apparently the only way
to do
it is to put a treeview on a form and call a specialize library, not as
clean as I wanted
it to be.....



Marshall Barton said:
Stephane said:
That was my fear.... but thx very much anyway,

Why would you fear that? The invisible control pool is much
better, it's faster and less complex as well as a better
programming practice.

It's actually my other post, but if don't mind I ask you in in here.....
the
data)

Sorry, but I don't understand what you're trying to do with
this.
--
Marsh
MVP [MS Access]


 
Back
Top