winformsdelphi-prismnumericupdownoxygene

How to prevent key entry with NumericUpDown control?


I have a numericupdown control on a winform and I noticed while testing that not only you have the option of changing the value by pressing up and down key but also simply entering the values from your keyboard.

I don't want that. I only want the user to be able to change the numericupdown's value only by clicking the up and down buttons within the box.

So far I simply can't find a solution.

Does anyone know how to do this?


Solution

  • To disable user from editing, set Readonly property to true.

    updown.ReadOnly = true;
    

    For more tailoring, you may refer this answer.