Reputation: 7388
I have a numericUpDown picker that's set to a range of acceptable years, defaulting to the current year.
The user can edit the number in the box with the keyboard: say if the number in there is 2011 to begin with, they can press backspace and the number in the box on screen will be 201. However, as far as I know, the value property of the control will never read a number below the minimum I set (1900 in this case).
I need a way to get the number currently in the box on the screen regardless of whether it is in my acceptable range or not. Anyone know how to do this?
Thanks!
Upvotes: 1
Views: 1179
Reputation: 57823
You can use the NumericUpDown.Text
property to get the current text, then parse to int
. It may not look like the property exists, but it's there.
The Text has no affect on the appearance of the NumericUpDown control; therefore, it is hidden in the designer and from IntelliSense.
Upvotes: 3