StrataFrame Forum

NumericUpDown and Read-Only

http://forum.strataframe.net/Topic18240.aspx

By Aaron Young - 7/30/2008

Hi,

If a NumericUpDown is set to read-only, then you can't type a value into the control but the arrow keys and spinner controls still allow values to be entered. I know the intercepting of the arrows keys can be turned off but I can't see a way of removing the spinner.

On a similiar note, is there a way to make a CheckBox read only?

Thanks in advance,

Aaron

By Trent L. Taylor - 8/1/2008

One little trick on the NumericUpDown is to set the Increment to 0 when in "read-only" mode and it will prevent the value from being changed.  A checkbox, on the other hand, is a little more difficult.  You can either make it disabled (probably not desirable) or handle the CheckChanged event and set the value back.