Ejemplo n.º 1
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     using (FormVehiculoAddEdit form = new FormVehiculoAddEdit(null))
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             FormVehiculo_Load(sender, e);
         }
     }
 }
Ejemplo n.º 2
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            //buscar objeto seleccionado en db
            int o   = (int)dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value;
            var obj = db.Vehiculoes.Select(q => q).Where(q => q.ID == o).FirstOrDefault();

            if (obj == null)
            {
                return;
            }
            //mandar el objeto encontrado al form de edicion
            using (FormVehiculoAddEdit form = new FormVehiculoAddEdit(obj as Vehiculo))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    FormVehiculo_Load(sender, e);
                }
            }
        }