how to access up down buttons in a NumericUpDown

  • Thread starter Thread starter Bamse
  • Start date Start date
B

Bamse

(this was posted on microsoft.public.dotnet.framework.windowsforms too)

Hi,
Is there a way (.NET, P/Invoke) to access individual buttons in a
NumericUpDown and DomainUpDown controls?

I need to disable/enable each one of them separately
if the .Value is smaller than myMinValue, the upper button is disabled;
if the .Value is bigger than myMaxValue, the lower button is disabled and
the other one is enabled;

Thank you,
Daniel
 
Daniel,

Unfortunately, this isn't possible with the NumericUpDownControl. The
reason for this is that the control uses one window for the up/down buttons
(so you can't disable a specific button), and the control doesn't expose a
windows message or some other mechanism to disable only one button.

Does not setting the Maximum and Minimum properties on the control suit
your needs? It will prevent a values outside of that range from being
entered.

Hope this helps.
 
You could get the controls that make up the Numeric control out of the controls collection and disable/enable them individually.
 
Back
Top