Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 857945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:28:40+00:00 2026-05-15T08:28:40+00:00

I am facing some trouble trying to configure a particular configuration for a NumericUpDown

  • 0

I am facing some trouble trying to configure a particular configuration for a NumericUpDown control in c#.

Basically, I have seen that I can set the Increment interval, but I would like to manage the Increment interval depending on which arrow is clicked (up or down). I have checked the events of the control, but I do not find an event for each arrow.

Basically, I want to achieve a control where, at different values, the increment is different.

from 0.00 to 5.00 increments of 0.01, from 5.00 to 20.00 increments of 0.04, and so on

Is this possible ?

Note: It would be useful also an historic value in the control for the last value when the valuechanged event is trigger. Does this exist?

Thanks in advance for any comment or suggestion!!!

EDIT: I edit this, because I did not explained it correctly, I guess. Here it is the reason because I would like to know which arrow was pressed, up or down.

This what I do have, more or less. I have added all the ranges, and some checkings using Modulo division to avoid incorrect values set directly in the value field using the keyboard instead of the arrows. The problem is, if I use arrow up to pass through a limit, everything is OK. However, if I use the arrow down, I miss one step.

    if (cuotaUno.Value >= 30M && cuotaUno.Value < 50M)
    {
        cuotaUno.Increment = 2M;
        if (!((cuotaUno.Value % 2M) == 0))
        {
            cuotaUno.Value = cuotaUno.Value - (cuotaUno.Value % 2M);
        }

    }

    if (cuotaUno.Value >= 50M && cuotaUno.Value < 100M)
    {
        cuotaUno.Increment = 5M;
        if (!((cuotaUno.Value % 5M) == 0))
        {
            cuotaUno.Value = cuotaUno.Value - (cuotaUno.Value % 5M);
        }

    }

In this case, If the value is 100 and I click down, it goes directly to 90 instead of 95. But, If I am at 90 and I click up, it goes to 95 and 100 correctly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:28:40+00:00Added an answer on May 15, 2026 at 8:28 am

    You can do the miracle using the NumericUpDown.ValueChanged event and NumericUpDown.Increment property.

    As a side note, just check the NumericUpDown.Accelerations property if it would help you as I don’t know if you’re very particular about the increment or the acceleration.

    UPDATE

    readonly decimal PART1 = 30M;
    readonly decimal PART2 = 50M;
    readonly decimal PART3 = 100M;
    readonly decimal INC1 = 1M;
    readonly decimal INC2 = 2M;
    readonly decimal INC5 = 5M;
    readonly decimal INC10 = 10M;
    
    private void cuotaUno_ValueChanged(object sender, EventArgs e)
    {
        decimal val = cuotaUno.Value;
        decimal inc = cuotaUno.Increment;
        decimal rem;
    
        if (val < PART1 && inc != INC1)
        {
            if (inc == INC2 && val == (PART1 -INC2))
                val += (inc - INC1);
            inc = INC1;
        }
        else if (val >= PART1 && val < PART2 && inc != INC2)
        {
            if (inc == INC5 && val == (PART2-INC5))
                val += (inc - INC2);
            inc = INC2;
            rem = val % INC2;
            if (rem != 0)
                val -= rem;
        }
        else if (val >= PART2 && val < PART3 && inc != INC5)
        {
            if (inc == INC10 && val == (PART3-INC10))
                val += (inc - INC5);
            inc = INC5;
            rem = val % INC5;
            if (rem != 0)
                val -= rem;
        }
        else if (val >= PART3 && inc != INC10)
        {
            inc = INC10;
            rem = val % INC10;
            if (rem != 0)
                val -= rem;
        }
    
        cuotaUno.Increment = inc;
        cuotaUno.Value = val;            
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting ready to implement a source control system (subversion) but I'm facing some
I have a public facing website that has been receiving a number of SQL
I'm facing some trouble when using the class QNetworkAccessManager . I use it to
I'm quite new to android and i'm facing some trouble with managing listviews... I'm
I am in trouble, so need some help. I have my file stored in
I have a service with some entities that I would like to expose in
The problem I'm facing is that it seems that some of the files generated
I'm using graph api from youtube , and i am facing some trouble .
Good afternoon I'm facing a trouble, trying to figure out how to use this
facing some strange behavior in OSB, i have configured WLS with MQ in client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.