using System.Windows.Forms;

public class LostForm : Form
{
	public Form lost;
	static int num=0;

	public LostForm() {
		 Button bch = new Button();
		 bch.Left = 20;
		 bch.Top = 20;
		 bch.Width = 200;
		 bch.Text = "Create and hide new form";
		 bch.Click += new System.EventHandler(ButtonCreateClicked);
		 Controls.Add(bch);

		 Button bsh = new Button();
		 bsh.Left = 20;
		 bsh.Top = 60;
		 bsh.Width = 200;
		 bsh.Text = "Open hidden form";
		 bsh.Click += new System.EventHandler(ButtonOpenClicked);
		 Controls.Add(bsh);

		 Text = "Form "+(++num);
		 lost = null;
	}

	public void ButtonCreateClicked(object sender, EventArgs e) {
		lost = new LostForm();
		// if you remove the next 1 or 2 lines, it works
		lost.Show();
		lost.Hide();
	}

	public void ButtonOpenClicked(object sender, EventArgs e) {
		if (lost != null) {
			lost.Visible = true;
			lost.Show();
		}
	}

	static void Main() 
	{
		Application.Run(new LostForm());
	}
}
