NumericUpdDown Overflow BUG!???!

G

gonzalez

I have a form with a NumericUpDown control, a ToolBar and an InputPanel.
The NumricUpDown is initialized as follows:
form.MinimizeBox = false;

nud.Minimum = 0;

nud.Maximum = 1000000;



When I call the form, it is constructed from an static method (singleton
form) and I call it as follows:

int i = 50000;

decimal d = Convert.ToDecimal(i);

nud.Value = d; // set NumericUpDown control value to 50000

form.ShowDialog(); // User can set the value to 50000 or some other number

int ii = Convert.ToInt32(nud.Value); // I get the wrong value --- negative
amount

MessageBox.Show(ii.ToString());



The problem is the value I get after the user has used the InputPanel to
changed the value, I get a negative amount, as if it were overflowing.

Could someonw help me confirm my bug, or am I seeing double!

Thanks,

--Ader.
 
I

Ilya Tumanov [MS]

It's by design as internal representation of value for NumericUpDown is 16
bit integer.

http://groups.google.com/group/micr...aa00f0bd320/3521d4926fed66aa#3521d4926fed66aa

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

gonzalez

Thank you for your response. It seems to me the Value property should
reflect that, or if decimal or some other property data types are retained
for compatibility with the regular framework, the Minimum and Maximum values
should enforce the valid range -- the current behavior it's very misleading,
because I can set a higher valid Maximum range than what the control
handles -- sounds like a control design bug.

Thanks Ilya,
--Ader.
 

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