This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, Currently the DoubleTextBox rounds off numbers to two decimal places. How can I change it so that the decimal places rounding off does not occur? (Could you please look at this issue as soon as possible. Gordon and I are close to our release and would like to start stabilizing our product fairly soon.) Thanks Oscar |
|
|
Hello Oscar By default, the DoubleTextBox should not be rounding the numbers. Could it be that you've set the DecimalPlaces property to 2? If this is still a problem, please let me know the values of all the properties that you've set on the DoubleTextBox so I can reproduce this. -Jason Fauchelle |
|
|
Hi Jason, Please find attached a solution which shows the issue. Run it. Select the first item of the listbox. Enter a value with more than three decimal in the first field. Select the second item in the listbox. Then reselect the first item in the listbox. The value displayed now only has 2 decimal places. I am using the dll version 6.0.2919.23292. (one of the latest nightly builds.) It should be included in the solution. Please let me know if you need additional information. Thanks Oscar |
|
|
Hello Oscar Thanks for the repro project. This issue is proving to be deceptively difficult to resolve, but I'll continue looking into this next week. -Jason Fauchelle |
|
|
Hello Oscar I've managed to find a way to support your scenario without changing the existing behavior. By default, the numeric editors will round the values to the default rounding of the current culture - this is what you've observed. While editing, additional decimal places can be entered (depending on the controls options), but they are rounded again when the control is reloaded (Or if it loses focus and certain control options are set). To disable this default rounding behavior, you will be able to set the DecimalPlaces property of DoubleTextBox to int.MaxValue. This will signal the control to disable default rounding. This support will be available in the next nightly build. -Jason Fauchelle |
|
|
Thanks Jason for working hard on this. I tried it and it's working. . . . Oscar |
|
|
float f = 10.123456F; float fc = (float)Math.Round(f * 100f) / 100f; Full Source : round a number to 2 decimal places Mercal |
|