Question Floating point values in NumericUPDown control

softhard

Active member
Joined
Sep 29, 2012
Messages
35
Programming Experience
Beginner
Hello,
I have a combobox where user selects different options. Based on the slected option, User allowed to enter values into two NumericUPDown controls. I have locked these NumericUPDown controls to min and max boundaries i.e. to unsigned integers. However, i would like to change these NumericUpDown controls Min&Max in one case of combobox selection to take only signed floating points. Once if the user again slected any other options after this NumericUPDown controls should be restricted to the previous values.

I have used this property in one case but it is not working.
NumericUpDown3.Minimum = -32768
'NumericUpDown3.Maximum = 32767
'NumericUpDown7.Minimum = -32768
'NumericUpDown7.Maximum = 32767
'NumericUpDown7.Increment = 0.1
'NumericUpDown3.Increment = 0.1


How could i acheive this to be work.
 
To allow floating point numbers update the .DecimalPlaces property to however many decimal points you'd like to allow. After that you can set the .Increment property to 0.1.

So basically, set .DecimalPlaces to 0 and .Increment to 1 when you want to work with whole numbers and then set them to, for example, 5 and 0.1 when you want to work with floating point numbers.
 
Thanks for the help, now it is working good.

But, if once select these two NumericUPDown controls in floating point mode and then i turn back to normal mode still these two NumericUPDown controls are in floating point mode. I know i should write all these max&min boudaries in each combobox selection. Is there any easy way to get back these controls into normal whole integer mode if the user selects any other case except floating point mode. I have many cases to write these steps and it will take lot a time and clumsy.
 
Back
Top