Message 1 of 9
Rounding Text Values problem

Not applicable
03-04-2005
05:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I use this code:
' Create text string (rounded to decimal places)
strText = ThisDrawing.Utility.RealToString(objCoord(2), _
acDecimal, iDecPlaces)
to round of numerical values to a certain number of decimal places. But it does not always work. Imagine I want to round to 2 decimal places and the value is 1.5 then the string returned is "1.5" and NOT "1.50".
I can't seem to work out how to get it to add the required zeroes to ensure it is to the right decimal places, apart from a manual test on the string returned and working it out myslef and adding the "0" until there. Even worse, a value like 12 would return "12" and not "12.00"
Any ideas?
Andrew
' Create text string (rounded to decimal places)
strText = ThisDrawing.Utility.RealToString(objCoord(2), _
acDecimal, iDecPlaces)
to round of numerical values to a certain number of decimal places. But it does not always work. Imagine I want to round to 2 decimal places and the value is 1.5 then the string returned is "1.5" and NOT "1.50".
I can't seem to work out how to get it to add the required zeroes to ensure it is to the right decimal places, apart from a manual test on the string returned and working it out myslef and adding the "0" until there. Even worse, a value like 12 would return "12" and not "12.00"
Any ideas?
Andrew