private void button1_Click(object sender, EventArgs e)//Aceptar { if (nudCantidad.Value <= _max && nudCantidad.Value > 0) { switch (_tipo) { //llamado desde add Pedido case 0: _addPed.EnviarDatos(Convert.ToInt32(nudCantidad.Value), _row); MessageBox.Show("Cantidad Agregada", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); _addPed.Enabled = true; this.Close(); break; //llamado desde main case 1: _adm.EnviarDatos(Convert.ToInt32(nudCantidad.Value), _row); _adm.Enabled = true; this.Close(); break; case 2: _adm.EnviarDatosProducto(Convert.ToInt32(nudCantidad.Value), _row); _adm.Enabled = true; this.Close(); break; } } else { MessageBox.Show("El valor debe estar entre 1 y " + _max, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }