• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

MFC: formatting numeric field


Is there any standar function availavle in MFC that will add a comma (',')
to a numeric value (say monetary) to make the field easier to read.

for e.g.

   300.00 converted to 300.00 (no change)
  3000.00 -----> 3,000.00
 30000.00 -----> 30,000.00
300000.00 -----> 300,000.00

The environment is VC++ 6.0 and the monetary value is being displayed in edit box.

2 Solutions
QlemoBatchelor and DeveloperCommented:
Best to use GetNumberFormatEx. You will have to format num to string with sprintf first, then put this into GetNumberFormatEx or GetNumberFormat.
You can use the COleCurrency class to convert monetary values in a standard way.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now