how to access up down buttons in a NumericUpDown

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
G

Guest

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top