Пример #1
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            prescription frm = new prescription();

            try
            {
                DataGridViewRow act = dataGridView1.Rows[e.RowIndex];
                frm.patientpre.Text = act.Cells["Nombre"].Value.ToString();
                frm.bdaypre.Text    = act.Cells["FechaNac"].Value.ToString();
                frm.MdiParent       = this.MdiParent;
                frm.Show();
                this.Close();
            }
            catch
            {
                MessageBox.Show("No se consiguio lo querido", "Error");
            }
        }
Пример #2
0
        private void resetaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            prescription f = new prescription();

            try
            {
                Form frm2 = Application.OpenForms.Cast <Form>().FirstOrDefault(x => x is prescription);
                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);
            }
        }