private void ClickGuardar(object sender, EventArgs e) { try { if (DatosValidos(2)) { var comboUbicacion = (ComboBox)controles.Find(x => x.Name == "comboUbicacion"); var ubicacion = (Ubicacion)comboUbicacion.SelectedItem; var dgv = (DataGridView)controles.Find(x => x.Name == "gridItems"); var lista = dgv.DataSource as List <AjusteStockVista>; stockBLL.Ajustar(lista); MessageBox.Show("El ajuste de stock fue creado exitosamente. Puede consultarlo en Reportes > Ajuste de Stock", "Ajuste de Stock", MessageBoxButtons.OK, MessageBoxIcon.Information); frm.Hide(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }