Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can a UserControl create another control at runtime?

Posted on 2004-08-06
3
Medium Priority
?
255 Views
Last Modified: 2011-09-20
I want to instantiate a control at runtine from the code of a UserControl. This is similar to a ComboBox creating a popup list. How can I do this? Do I just call "New" and "Show"? Or do I also have to link the new control with the parent form?

thanks
0
Comment
Question by:marios
  • 2
3 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11734392
Dim x as new yourusercontrol
'set the properties of your usercontrol and then add them to the form controls

me.controls.add(x)
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 500 total points
ID: 11734558
Sorry, too hasty in reading your question.

When do you want to create your runtime control, as soon as you instanciate the usercontrol or in a method or property off  the usercontrol

the code will remain the same

dim x as new textbox
x.left = 10
x.top = 10
'etc
me.controls.add(x)
0
 

Author Comment

by:marios
ID: 11746321
I just want to create something like a ComboBox popup list. I will try the code and let you know.

thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question