Link to home
Start Free TrialLog in
Avatar of Guillo
Guillo

asked on

Creating Controls in run-time

How can I create a control (any control, a textbox, a picture control, any OCX control,etc..) in runtime, from scrach?. I mean, it is possible to create a control via code?
Avatar of janim
janim

you cannot create a control from scratch unless you already have at least one control (of the type you want to create) that is loaded on your form with index property set to any value.

if you don't want to see this initial control on you form, just set its visible property to false.  you create controls using the 'load' command then make its visible property to true.
Avatar of Guillo

ASKER

Thanks, Janim, i've alredy assumed that a base control was necesary but i need more information.
OK, I understand the fact to have a contron of the type i want. Then the question is:
Let's suppose i have a command button for 1 action(in this case hidden, because i want this only as a "base"). How can i create copies of this button for x actions (assume that there is a variable ammount of actions, so i don't know how many buttons they may be)?
And, It's possible to do the same with other controls (Activex OCX, data controls, etc)?
Thanks.
Avatar of Guillo

ASKER

Please help me, i need an answer as soon as possible.
there is a function calles 'LoadControl' in VB5, but you need an objects CLSID to use it. but look it up and try it
can you further explain your question?
by action do you mean the event corresponding to your control?
can you give me a sample algorithm of what you need to do?  

ASKER CERTIFIED SOLUTION
Avatar of waty
waty
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Guillo

ASKER

Thank you!
I was seasrching for a general solution aplicable for all cases. And that's is!