开发者

Running Code From A Particular Context After A Form Closes?

I want to run some code in this context after the form created here closes.

开发者_如何学CForm1 Form1 = new Form1();
Form1.Show(); //<-After this closes, I want to run code from this context, using ShowDialog() is not an option


just register for the FormClosing event of the Form

void MyClosingEvent(object o, FormClosingEventArgs args)
{
}

private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
    Form1 form1 = new Form1();
    form1.FormClosing += new FormClosingEventHandler(MyClosingEvent);
    //Or if you have C# 2 or higher: 
    //form1.FormClosing += MyClosingEvent;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜