问题描述
好吧,我是Windows窗体应用程序的新手,我创建了一个接受值并将其提交到db的窗体,但是在单击按钮时,我需要关闭当前窗体并重定向到另一个窗体,该怎么做.感谢您的帮助.祝您有个美好的一天
ok im a newbie to windows form application, ive created a form which takes in values and submits it into a db but on button click i need to close the current form an redirect to another form, how can this be done. Thanks for ur help. Have a good day cheers
推荐答案
Form2 f = new Form2();
this.Hide();
f.Show();
Form2 fm2 = new Form2();
fm2.ShowDialog();
这将打开一个Form2作为新窗口.但是,如果您要关闭电流并打开一个新的电流,则必须使用MDIParent和MDIChild组合
http://msdn.microsoft.com/en-us/library/7aw8zc76 (v = vs.80).aspx [ ^ ]
使用
this will open a Form2 as new window. but if u want to close current and to open a new one, then you have to use MDIParent and MDIChild combination
http://msdn.microsoft.com/en-us/library/7aw8zc76(v=vs.80).aspx[^]
use
fm2.Show();
如果form2是MDIChild.
希望对您有所帮助.
if form2 is MDIChild.
Hop this helps..
这篇关于Windows应用程序中的表单重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!