Solved

How can a UserControl create another control at runtime?

Posted on 2004-08-06
3
244 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 125 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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 …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

820 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