Solved

How can a UserControl create another control at runtime?

Posted on 2004-08-06
3
237 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
Comment Utility
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
Comment Utility
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
Comment Utility
I just want to create something like a ComboBox popup list. I will try the code and let you know.

thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

7 Experts available now in Live!

Get 1:1 Help Now