Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to display numbers in text boxes in a decimal format in various text boxes. This makes it easier for my users to read. For example 1,234,567.89 is easier to read than 1234567.89

I know how to do this normally of course, but my problem is that the textboxes are bound to an object in the Business Object Layer (BOL). As a result, any formatting I apply is over-ridden by the BOL back to what I it was before formatting. This is because the public property in the class to which the text box is bound is type decimal, so it changes 1,234,567.89 back to 1234567.89 in the textbox. Changing the public property to type String is not an option as it is used in other areas of my project.

Does anyone know please how to rectify this issue? I would be most grateful for any assistance.


Ennex
Posted
Comments
Sergey Alexandrovich Kryukov 31-Dec-13 22:48pm    
The problem looks quite artificial to me. You know the main thing: how to format numbers the way you think is optimal. Don't let some formal technique (the particular binding you use) dominate over your solution based on your requirements and common sense. If the default binding you are using does not satisfy you, don't use it, use your own. I cannot see your code to advise more, but I think you understand no less than I do: nothing here looks impossible; after all, the one who created binding which you don't like used the same resource as you can use...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900