private void dgv_patients_DoubleClick(object sender, EventArgs e) { textBox1.Text = dgv_insurance.Rows[dgv_insurance.CurrentRow.Index].Cells["i_id"].Value.ToString(); if (formulario_devolver == true) { DialogResult = DialogResult.OK; this.Close(); } else if (formulario_devolver == false) { addinsurance f = new addinsurance(); f.formulario_devolver = true; f.txt_i_id.Text = dgv_insurance.Rows[dgv_insurance.CurrentRow.Index].Cells["i_id"].Value.ToString(); if (f.ShowDialog() == DialogResult.OK) { load_insurance_dgv(); } } }
private void agregarSeguroToolStripMenuItem_Click(object sender, EventArgs e) { addinsurance f = new addinsurance(); try { Form frm2 = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x is addinsurance); if (frm2 != null) { frm2.BringToFront(); MessageBox.Show("Esta ventana ya esta abierta.", "Error"); return; } else { f.MdiParent = this; f.Show(); } } catch (Exception ex) { MessageBox.Show("No se puede abrir el ventana solicitado. Razón: " + ex.Message, "Error al abrir la ventana.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }