private void btnAgregar_Click(object sender, EventArgs e) { errorProvider1.Clear(); if (Utilidades.ValidarForm2(this, errorProvider1) == false) { return; } try { string mensaje = ""; P.Idproducto = Program.Idproducto; P.Idalmacen = Convert.ToInt32(cbAlmacen.SelectedValue); mensaje = P.AsignarAlmacen(); if (mensaje == "1") { MessageBoxEx.Show("Asignado con éxito", "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (mensaje == "2") { MessageBoxEx.Show("Producto ya tiene almacén asignado", "FactSYS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } LlenarGrid(); Limpiar(); } catch (Exception ex) { MessageBoxEx.Show(ex.Message); } }