Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

187
Vistas
How to swap arrow buttons functionality on NumericUpDown control?

I want to swap the Up and Down arrows (functionality only, not the actual arrows) on NumericUpDown control. For example on clicking the UP arrow the value should decrease and similarly on clicking the Down arrow the value should increase.

I tried to inherit from NumericUpDown class and override UpButton() and DownButton(). I thought that simply swapping the code in between these two methods should work. But upon pasting the DownButton() code into overridden UpButton(),

public class MyCustomNumericUpDown : NumericUpDown
{
    public override void UpButton()
    {
        SetNextAcceleration();
        if (base.UserEdit)
        {
            ParseEditText();
        }

        decimal num = currentValue;
        try
        {
            num -= Increment;
            if (num < minimum)
            {
                num = minimum;
                if (Spinning)
                {
                    StopAcceleration();
                }
            }
        }
        catch (OverflowException)
        {
            num = minimum;
        }

        Value = num;
    }
}

the above program throws the following errors.

The name 'SetNextAcceleration' does not exist in the current context
The name 'currentValue' does not exist in the current context
The name 'minimum' does not exist in the current context
The name 'Spinning' does not exist in the current context
The name 'StopAcceleration' does not exist in the current context
The name 'minimum' does not exist in the current context

I see all these methods and variables are set to private in the base class. Which might be throwing these "does not exist" errors.

Anyone know how to do this? I just want the arrow buttons functionality swapped. For example on clicking the UP arrow the value should decrease and similarly on clicking the Down arrow the value should increase.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can derive from the NumericUpDown and override UpButton and DownButton methods like this (by calling base.TheOtherMethod to swap the functionality):

public class CrazyNumericUpDown : NumericUpDown
{
    public override void UpButton()
    {
        base.DownButton();
    }
    public override void DownButton()
    {
        base.UpButton();
    }
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda