如何将一个按钮链接到c#windows窗体应用程序中的任何窗体 [英] how to link one button to any form in c# windows form application
本文介绍了如何将一个按钮链接到c#windows窗体应用程序中的任何窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将一个按钮链接到c#windows表单应用程序中的任何表单(例如)如果我单击下一个按钮然后链接下一页的相关表单。
how to link one button to any form in c# windows form application (e.g) if I click next button then it links related form for next page.
推荐答案
如果你想使用单个按钮打开多个表单,那么你的表单名称必须像this..form1,form2,form3或者我可以说.. frmwindow1,frmwindow2 ..表示名称在最后一个数字之前必须相同。
尝试这个,
我希望您的按钮位于Mdi父窗体上以获得更好的可视化效果。
In你的按钮点击事件插入此代码。
i = i + 1
调用ViewChildForm(Form& i)
并定义viewchildform如下,
If you want to open multiple form using single button then, your form name needs to be like this..form1,form2,form3 or I can say.. frmwindow1,frmwindow2.. Means form name must be same before numeric in last.
try this,
I am hoping your that button is on Mdi parent form for better visualization.
In your button click event insert this code.
i=i+1
call ViewChildForm("Form" & i)
and define viewchildform as follow,
Private Sub ViewChildForm(frm As Form)
frm.MdiParent = Me
frm.Show()
End Sub
我在这里考虑,你的所有表单名称以Form开头,以数字序列结束。
喜欢form1,form2,form3等。
我在MDI父表单中公开定义i为整数。初始值= 0。
使用此逻辑。
Here I consider, your all form names starts with Form and end with sequence of number.
like form1,form2,form3 etc.
I define i as integer publicly in that MDI parent form. with initial value=0.
Use this logic.
这篇关于如何将一个按钮链接到c#windows窗体应用程序中的任何窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文