Ejemplo n.º 1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            frmAgregarVehiculo frm = new frmAgregarVehiculo(null);

            this.Close();
            frm.ShowDialog();
        }
Ejemplo n.º 2
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            //try
            //{
            //    if (dgvListaVehiculos.CurrentRow != null && dgvListaVehiculos.CurrentRow.Selected == true)
            //    {


            //        DataGridViewSelectedRowCollection filasselec = dgvListaVehiculos.SelectedRows;
            //        int id = int.Parse(filasselec[0].Cells["ID"].Value.ToString());

            //        frmAgregarVehiculo frm = new frmAgregarVehiculo(id);
            //        frm.ShowDialog();
            //    }
            //    else
            //    {
            //        MessageBox.Show("Seleccione el registro a editar");
            //    }
            //}
            //catch (Exception)
            //{

            //    throw;
            //}

            int?id = getId();

            if (id != null)
            {
                frmAgregarVehiculo frmEditar = new frmAgregarVehiculo(id);
                this.Close();
                frmEditar.ShowDialog();
            }
            else
            {
                MessageBox.Show("Seleccione el registro a editar");
            }
        }