问题描述
您好b $ b
我只想在单击按钮时以Windows窗体打开Usercontrol(包含按钮和文本框)。
我用button1和botton2创建了form1,并创建了Usercontrol1和Usercontrol2。现在在form1中我想在按下button1时调用Usercontrol1(在form1中打开它),然后按button2显示Usercontrol2并隐藏Usercontrol1但我不知道该怎么做。我在form1中为Usercontrol1创建了一个对象(Usercontrol1.visible = true),但它没有用。
请帮忙。
谢谢
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
这篇关于如何在单击按钮时在表单中显示UserControl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!