Beispiel #1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            EdicionCargos f = new EdicionCargos();

            f.lblID.Visible      = false;
            f.txbIdCargo.Visible = false;
            f.lblCargo.Margin    = new Padding(3, 30, 0, 0);
            f.ShowDialog();
            CargarDatos();
        }
Beispiel #2
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (Convert.ToInt32(dtgvDatos.Rows.Count.ToString()) <= 0)
            {
                MessageBox.Show("Actualmente no existe ningún registro", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (MessageBox.Show("Desea editar el registro seleccionado?", "Pregunta", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    EdicionCargos f = new EdicionCargos();

                    //Sincronizando interfaz gráfica con registro seleccionado
                    //(Muestra los datos del registro a editar)
                    f.txbIdCargo.Text = dtgvDatos.CurrentRow.Cells["idcargo"].Value.ToString();
                    f.txbCargo.Text   = dtgvDatos.CurrentRow.Cells["cargo"].Value.ToString();
                    f.ShowDialog();
                    CargarDatos();
                }
            }
        }