private void dgv_appointment_DoubleClick(object sender, EventArgs e) { textBox1.Text = dgv_appointment.Rows[dgv_appointment.CurrentRow.Index].Cells["dm_id"].Value.ToString(); if (formulario_devolver == true) { DialogResult = DialogResult.OK; this.Close(); } else if (formulario_devolver == false) { addappointment f = new addappointment(); f.formulario_devolver = true; f.txt_dm_id.Text = dgv_appointment.Rows[dgv_appointment.CurrentRow.Index].Cells["dm_id"].Value.ToString(); if (f.ShowDialog() == DialogResult.OK) { load_appointment_dgv("b"); } } }
private void agregarCitaToolStripMenuItem_Click(object sender, EventArgs e) { addappointment f = new addappointment(); try { Form frm2 = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x is addappointment); 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); } }