NumericUpDown.Value cannot be > 2^16

  • Thread starter Thread starter Steve B.
  • Start date Start date
S

Steve B.

Hi,

I've a strange behaviour on the numericupdown control.

Althought it property "Value" is decimal type, the value cannot be > 2^16.
If the value is greater, it becomes 0.

Here is a sample code that illustrate this :

this.numericUpDown1.Maximum = 1000000;

this.numericUpDown1.Value = 10000; // < 2^16

MessageBox.Show(

this.numericUpDown1.Value.ToString() // Show 10000

);

this.numericUpDown1.Value = 100000;// > 2^16

MessageBox.Show(

this.numericUpDown1.Value.ToString() // Show 0

);



Is there any knowledge about this ?



Thanks,

Steve
 
U¿ytkownik Steve B. napisa³:
Hi,

I've a strange behaviour on the numericupdown control.

Althought it property "Value" is decimal type, the value cannot be > 2^16.
If the value is greater, it becomes 0.

Try

MessageBox.Show(numericUpDown1.Text);

and

x = Decimal.Parse(numericUpDown1.Text);




Konrad.
 

:-)

Use Text property, not Value.
For me it's working:

// set maximum on 3,000,000
numericUpDown1.Maximum = 3000000;

// set 1,000,001
numericUpDown1.Text = "1000001";

// double it
numericUpDown1.Text = String.Format("{0}",
Decimal.Parse(numericUpDown1.Text) * 2);

// And you will get 2,000,002
MessageBox.Show(numericUpDown1.Text);



Konrad.
 
Back
Top