custom format 0:0% is only multiplying by 10 when it should multiply by 100.

  • Thread starter Thread starter Ian Burton
  • Start date Start date
I

Ian Burton

Hi,
I am trying to format a percentage.
I have a single value 0.1625.
when I use the format 0:0%
I get the output 1.6%.
This is wrong. it should be 16.25%
Any help with this would be appreciated. I just do not know why all the
percentages lose 1 order despite them being stored correctly in the access
database.
Also, if we fix this, will it work ok for data entry if I put in 16.25? i.e.
will it convert it back to 0.1625 going back to the database?
thanks for youre time,
Ian
 
Ian Burton said:
Hi,
I am trying to format a percentage.
I have a single value 0.1625.
when I use the format 0:0%
I get the output 1.6%.
This is wrong. it should be 16.25%
Any help with this would be appreciated. I just do not know why all the
percentages lose 1 order despite them being stored correctly in the access
database.
Also, if we fix this, will it work ok for data entry if I put in 16.25?
i.e. will it convert it back to 0.1625 going back to the database?
thanks for youre time,
Ian


I found out by a lot of trial and error that if I use custom format: ##.00%
it does format it correctly. However, when I type in 12.5, it then formats
it as 1250%. Why is this, and how might I get the data input working ok for
this text box?
Do I need an after update event to check every time the data is changed, and
divide by 100 if it is over 100 or something similar?
Thanks again,.
Ian
 
Ian Burton said:
I found out by a lot of trial and error that if I use custom format: ##.00%
it does format it correctly. However, when I type in 12.5, it then formats
it as 1250%. Why is this, and how might I get the data input working ok for
this text box?
Do I need an after update event to check every time the data is changed, and
divide by 100 if it is over 100 or something similar?
Thanks again,.
Ian

"P" is the formatting string for percentages, as in:
Console.WriteLine("{0:P}", x).

Mike
 
Back
Top