Click here to Skip to main content
11,930,069 members (49,691 online)
Click here to Skip to main content
Add your own
alternative version


9 bookmarked

NumericUpDown with correct read-only behavior

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

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 10 Nov 2006
Article Copyright 2006 by dr4cul4
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid