Click here to Skip to main content
13,597,963 members
Click here to Skip to main content
Add your own
alternative version


9 bookmarked
Posted 10 Nov 2006
Licenced CPOL

NumericUpDown with correct read-only behavior

, 10 Nov 2006
Rate this:
Please Sign up or sign in to vote.
A simple article showing another bug in .NET Framework 2.0.


When writing a simple application, I needed one of the numeric boxes to be read only, so I just changed the ReadOnly property of NumericUpDown to true. But after a while, I noticed that I can change the value in it, not by typing, but by using the up and down buttons.


To save people time, I posted this article presenting a simple and fast solution to the problem:

public class FixedNumericUpDown : NumericUpDown
    public override void DownButton()
        if (ReadOnly)

    public override void UpButton()
        if (ReadOnly)



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
Poland Poland
Hi to all.

I’m a software developer who works in a small company. I started programming when I was 10 (or less, can't remember) on not mine C64 – those were the good times :P Now I’m coding mainly in C# / C++, but my favorite language is C.

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
Member 864580517-Jul-13 5:05
memberMember 864580517-Jul-13 5:05 
GeneralMy vote of 4 Pin
Toli Cuturicu19-Aug-10 5:14
memberToli Cuturicu19-Aug-10 5:14 
GeneralMight be even better Pin
MillionsterNutzer21-May-10 10:05
memberMillionsterNutzer21-May-10 10:05 
GeneralNumericUpDown.Increment = 0; Pin
Eugene Goryachev11-Apr-08 0:10
memberEugene Goryachev11-Apr-08 0:10 
GeneralFix without replacing the control Pin
los.12-Jun-07 22:32
memberlos.12-Jun-07 22:32 
GeneralRe: Fix without replacing the control Pin
Lemuel.Adane15-May-09 1:20
memberLemuel.Adane15-May-09 1:20 
Generaldisable updown-control Pin
jls1716-Nov-06 7:41
memberjls1716-Nov-06 7:41 
AnswerRe: disable updown-control Pin
dr4cul416-Nov-06 21:27
memberdr4cul416-Nov-06 21:27 
Generalcode style opinion Pin
Tornacious14-Nov-06 8:17
memberTornacious14-Nov-06 8:17 
QuestionMore readable? Pin
nurgling10-Nov-06 6:04
membernurgling10-Nov-06 6:04 
AnswerRe: More readable? Pin
Marc Leger10-Nov-06 8:33
memberMarc Leger10-Nov-06 8:33 
AnswerRe: More readable? Pin
dr4cul411-Nov-06 2:14
memberdr4cul411-Nov-06 2:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.180621.3 | Last Updated 10 Nov 2006
Article Copyright 2006 by dr4cul4
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid