the reason is that first time when it shows the
form2 it
changes f2 value now which is
not null and after closing it and executing the command again
f2 is not null so it will not run the command.
To fix this write this
private Form2 f2=null;
private void f2ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (f2 == null)
{
f2 = new Form2();
f2.ShowDialog();
f2=null;
}
else
{
f2.Activate();
}
}
}