naouf gyd

naouf gyd

  • NA
  • 15
  • 10.1k

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

Nov 9 2015 1:41 PM
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)