Add two members and handle the menu commands in this manner:
Form2 form2A = null;
Form2 form2B = null;
private void menuAToolStripMenuItem_Click( object sender, EventArgs e )
{
if( form2A == null )
{
form2A = new Form2( );
// load data from first table...
form2A.Show( );
}
form2A.Activate( );
}
private void menuBToolStripMenuItem_Click( object sender, EventArgs e )
{
if( form2B == null )
{
form2B = new Form2( );
// load data from second table...
form2B.Show( );
}
form2B.Activate( );
}
The code is similar; therefore it can be combined into some common function.
Probably can be done in case of MDI forms too.