471,327 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,327 software developers and data experts.

Showing Windows Forms

Hello,

I got my main form called Form1. Now I added Form2. On Form1 there is a
button that would make Form2 appear. What code should I add to the button so
that Form2 will appear when the button is pressed?

Mateusz Rajca
Dec 8 '05 #1
2 987
Form2 f2 = new Form2();
try
{
f2.ShowDialog();
}
finally
{
f2.Dispose();
}

If you don't want to show Form2 as a modal form use Show() instead.

Mateusz Rajca wrote:
Hello,

I got my main form called Form1. Now I added Form2. On Form1 there is a
button that would make Form2 appear. What code should I add to the button so
that Form2 will appear when the button is pressed?

Mateusz Rajca

--
Vit Zayko
Dec 8 '05 #2
Thank You

"Vitaly Zayko" wrote:
Form2 f2 = new Form2();
try
{
f2.ShowDialog();
}
finally
{
f2.Dispose();
}

If you don't want to show Form2 as a modal form use Show() instead.

Mateusz Rajca wrote:
Hello,

I got my main form called Form1. Now I added Form2. On Form1 there is a
button that would make Form2 appear. What code should I add to the button so
that Form2 will appear when the button is pressed?

Mateusz Rajca

--
Vit Zayko

Dec 8 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Daniel Hill | last post: by
4 posts views Thread by Gerry Viator | last post: by
2 posts views Thread by Bardo | last post: by
reply views Thread by Alireza Haghshenass | last post: by
1 post views Thread by Henry | last post: by
8 posts views Thread by jy836 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.