how to create new control in run time mode?

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

Guest

How to create new control in run time mode

I need to create new control (f.e. Label) in run time mode. When i use
Dim ctrLab as Labe
Set ctrLab = New Labe
an Error occurs: ActiveX component can't create object

Please, help

I don't need to create new control in design mode, so CreateControl metod is unusefull for me.
 
You cannot. But you can create as many controls as you are likely to need
at design time. Make them all Visible=false. Then at runtime, make the
ones you want Visible=true. And set the captions etc to be the text you
want. In fact you really only need as many controls as you want to see on
the form *at the same time*. You can move them around, and change captions,
and any other property you like, to suit a particular view of the form in
any instance.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
losmac said:
How to create new control in run time mode?

I need to create new control (f.e. Label) in run time mode. When i use:
Dim ctrLab as Label
Set ctrLab = New Label
an Error occurs: ActiveX component can't create object!

Please, help.

I don't need to create new control in design mode, so CreateControl metod
is unusefull for me.
 
Unless you have a very unusual requirement, it should never be necessary to
create controls at runtime. Doing do almost always suggests that you have
an incorrect data structure. Fix the structure, and the need should vanish.

Perhaps if you explained what you are trying to achieve, we can be more
help.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
losmac said:
Thank You very much Adrian,

I know that method.
My question is "how to create controls in run time mode" because the
number of controls is not knowing at design mode. It's depends from answer
of user.
 
Back
Top