c#中windows 窗体应用程序 怎么实现关闭一个串口的同时打开一个新窗口?
如题:关闭窗口的时候触发打开的窗口的事件..
要怎么写... --------------------编程问答-------------------- 窗体的关闭事件:FormClosed中。写一行:
new System.Threading.Thread(delegate{Application.Run(new Form());}).Start();--------------------编程问答-------------------- 关闭子窗口的的同时触发打开主窗口
不要 new 怎么不行 ... --------------------编程问答-------------------- private void Form_Closed(object sender, FormClosedEventArgs e)
{
new System.Threading.Thread(delegate { Application.Run(new Form1()); }).Start();
}
编译有错误 --------------------编程问答-------------------- er...
惜字如金,你提问的不能把问题描述详细么?编译错误,错误时神马? --------------------编程问答-------------------- 错误1 在以下方法或属性之间的调用不明确:“System.Threading.Thread.Thread(System.Threading.ThreadStart)”和“System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)”
C:\Users\lupaN\Documents\Visual Studio 2008\Projects\120\120\Form2.cs 23 13 120
这个.. --------------------编程问答-------------------- 应该是关闭当前窗口,打开新的窗口是吧?
在要执行些操作的按钮事件中添加:
newForm nf= new newForm(); //newFrom 新窗口对像
nf.Show();
this.Visible=false; --------------------编程问答-------------------- private void Form_Closed(object sender, FormClosedEventArgs e)
{
newForm nf = new newForm(); //newFrom 新窗口对像
nf.Show();
this.Visible = false;
}
错误 1 找不到类型或命名空间名称“newForm”(是否缺少 using 指令或程序集引用?) C:\Users\lupaN\Documents\Visual Studio 2008\Projects\120\120\Form2.cs 23 13 120
错误 2 找不到类型或命名空间名称“newForm”(是否缺少 using 指令或程序集引用?) C:\Users\lupaN\Documents\Visual Studio 2008\Projects\120\120\Form2.cs 23 30 120
--------------------编程问答-------------------- //引用 5 楼 lp617920520 的回复:
错误1 在以下方法或属性之间的调用不明确:“System.Threading.Thread.Thread(System.Threading.ThreadStart)”和“System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)”
C:\Users\lupaN\Documents\Visual Studio……
你自己多敲了一份,抄都能抄错啊。复制粘贴你都能出错,我实在无法淡定的安慰你了。再这么粗心,改行吧。 --------------------编程问答-------------------- 上面一行是窗口关闭事件..
private void Form_Closed(object sender, FormClosedEventArgs e)
form_closed事件
我是想这个事件来触发窗口打开.
补充:.NET技术 , 非技术区