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
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
*** Want to find answers instantly? Here's how... ***
1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
"Steve B." <steve_...@com.msn.swap_com_and_msn> wrote in message
news:OXZ11443...@tk2msftngp13.phx.gbl...
> 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.
"Konrad" <x...@xxx.pl> a écrit dans le message de news:
dkfdei$40d$1...@atlantis.news.tpi.pl...
:-)
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.