Showing Windows Forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Thank You

Vitaly Zayko said:
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.
 
Back
Top