Bug 661750 is about an exception when converting the value of a NumericUpDown 
control to hexadecimal, if the value is 0.
This conversion happens in the UpdateEditText method of the NumericUpDown 
control. The author of the code added the following comments:

// Decimal.ToString doesn't know the "X" formatter, and
// converting it to an int is narrowing, so do it
// manually..

It'd be possible to fix this conversion bug by updating the conversion code a 
little, but instead, Oliver proposes (in bug report 661750) that we do this 
instead:

Text = ((Int64)dvalue).ToString("X", CultureInfo.CurrentCulture);

Which seems right, as Int64.MaxValue is actually the maximum value of a 
NumericUpDown in hexa mode, not Decimal.MaxValue. So there would be no 
precision loss, actually.
I support this suggestion very strongly, as that'd mean we'd replace 131 lines 
of code with a single one. Slimming down the NumericUpDown code from 615 lines 
to 485, and therefore avoiding more potential bugs.

Does this seem alright?

Oh, and while I'm here, do you prefer "Int64" or "long"? I don't think I've 
seen that specified in the Mono guidelines. But from what I've seen "int" is 
more commonly used than "Int32", so it'd probably make sense to go for "long".
_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Reply via email to