private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { addprocedure frm = new addprocedure(); DataGridViewRow act = dataGridView1.Rows[e.RowIndex]; frm.idprocedure_txt.Text = act.Cells["ID"].Value.ToString(); frm.pidpatient_txt.Text = act.Cells["IdPaciente"].Value.ToString(); frm.pnamepatient_txt.Text = act.Cells["Paciente"].Value.ToString(); frm.piddoctor_txt.Text = act.Cells["IdDoctor"].Value.ToString(); frm.pnamedoctor_txt.Text = act.Cells["Doctor"].Value.ToString(); frm.procedure_txt.Text = act.Cells["Procedimiento"].Value.ToString(); frm.realpay_txt.Text = act.Cells["Precio"].Value.ToString(); frm.iscoverage_txt.Text = act.Cells["Cobertura"].Value.ToString(); frm.pricepay_txt.Text = act.Cells["Total"].Value.ToString(); frm.tooth_txt.Text = act.Cells["Diente"].Value.ToString(); frm.dateprocedure_dtp.Text = act.Cells["Fecha"].Value.ToString(); frm.groupBox3.Hide(); frm.saveprocedure_btn.Hide(); frm.clear_btn.Hide(); frm.MdiParent = this.MdiParent; frm.Show(); }
private void agregarProcedimientoRegularToolStripMenuItem_Click(object sender, EventArgs e) { addprocedure f = new addprocedure(); try { Form frm2 = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x is addprocedure); 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); } }