private void paycmd_Click(object sender, EventArgs e) { invoiceid = Convert.ToString(invoicetxt.Text.Trim()); if (ip == null) { ip = new InvoicePayment(); ip.MdiParent = this.MdiParent; ip.FormClosed += new FormClosedEventHandler(ip_FormClosed); ip.Show(); this.Close(); } else { ip.Activate(); ip.FormClosed += new FormClosedEventHandler(ip_FormClosed); ip.Show(); } }
void ip_FormClosed(object sender, FormClosedEventArgs e) { ip = null; }