1
Answer

How to show UserControl in a form when a button is clicked?

Ask a question
naouf gyd

naouf gyd

8y
382
1
Hi
 
 I just want to open a Usercontrol (which contains buttons and textboxes) in a windows form when I click a button.
 
I created form1 with button1 and botton2 and also created Usercontrol1 and Usercontrol2 . now in form1 I want to call Usercontrol1 (open it in form1) when button1 is pressed and then press button2 to show Usercontrol2 and hide Usercontrol1 but I dont know how to do it. I created an object for Usercontrol1 in form1 (Usercontrol1.visible = true) but it didnt work.
please help.
Thank you  

Answers (1)