Click here to Skip to main content
15,611,704 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Dear Sir/Madam

I have a Form1 in my C# Project. Within this project I haved added a UserControl. Now my question is:

How can i show the UserControl from Form1 by clicking the button,
(the similarity would be like: e.g...)

form1 frm = new form1();;

But for UserControl this is not working.
Please any help would be very greatfull.

Thanks in advance

Manfred Rudolf Bihy 21-Nov-10 15:19pm    
Is the user control already on the form or do you want to add it dynamically?
If you want to add it dynamically use Heinzzy's or OriginalGriff's answer.
Sandeep Mewara 22-Nov-10 0:43am    
Update from OP:
the UserControl is not in the form, i want to call it dynamically...

kind regards


MyUserControl myControl1 = new MyUserControl();
Share this answer
MyUserControl muc = new MyUserControl();
muc.Location = pointIWantItAt;
This add the user control to the current class (form) Controls list, and this will make it visible.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900