开发者

C#: Getting a button to display a preset form

I (currently) have two forms, one that needs to call the other.开发者_运维百科 In other words, by clicking a certain button in Form1, Form2 needs to "pop up", like a dialog box. I know I have to get a reference in both forms, but I'm not entirely sure how to do this. What is a decent tutorial/beginner site to learn about GUIs in C#?


You can try this:

protected void Button1_Click(object sender, EventArgs e)
{
    Form2 myForm = new Form2();
    myForm.ShowDialog();
}

ShowDialog forces the user to close that window before s/he can access the rest of the application.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜