Solved

How can a UserControl create another control at runtime?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Javascript Refresh Parent Page from Popup 3 50
Recommendation vb6 to vb.net or others 14 112
Getfiles in vb.net 28 43
Crystal reports vb.net 2 20
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 …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now