Solved

MFC: formatting numeric field

Posted on 2007-04-02
2
264 Views
Last Modified: 2013-11-20
Hello,

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.

Thanks
0
Comment
Question by:pbsmbc
2 Comments
 
LVL 69

Accepted Solution

by:
Qlemo earned 125 total points
ID: 18837767
Best to use GetNumberFormatEx. You will have to format num to string with sprintf first, then put this into GetNumberFormatEx or GetNumberFormat.
0
 
LVL 19

Assisted Solution

by:alb66
alb66 earned 125 total points
ID: 18838082
You can use the COleCurrency class to convert monetary values in a standard way.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
windows 10 how make picture as desktop background 2 64
move a line in eclipse 3 104
no14 challenge 14 69
Authenticate using sesu from script 7 36
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question