Exemple #1
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            FormRege frm = new FormRege();

            frm.txtid.Text        = dataGridView1.CurrentRow.Cells[0].Value.ToString();
            frm.txtnombre.Text    = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            frm.txtapellido.Text  = dataGridView1.CurrentRow.Cells[2].Value.ToString();
            frm.txtdireccion.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
            frm.txttelefono.Text  = dataGridView1.CurrentRow.Cells[4].Value.ToString();
            frm.ShowDialog();
        }
Exemple #2
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            FormRege frm = new FormRege();

            if (dataGridView1.SelectedRows.Count > 0)
            {
                frm.txtid.Text        = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                frm.txtnombre.Text    = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                frm.txtapellido.Text  = dataGridView1.CurrentRow.Cells[2].Value.ToString();
                frm.txtdireccion.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString();
                frm.txttelefono.Text  = dataGridView1.CurrentRow.Cells[4].Value.ToString();
                frm.ShowDialog();
            }
            else
            {
                MessageBox.Show("Debe seleccionar una fila");
            }
        }