Beispiel #1
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     using (FormVehiculoModeloAddEdit form = new FormVehiculoModeloAddEdit(null))
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             FormVehiculoModelo_Load(sender, e);
         }
     }
 }
Beispiel #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.Modelo_Vehiculo.Select(q => q).Where(q => q.ID == o).FirstOrDefault();

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