Solved

MFC: formatting numeric field

Posted on 2007-04-02
2
258 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 68

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 124
Shell script to login to remote m/c and execute commands 10 78
sameEnds challenge 3 134
wordmultiple challenge 12 119
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now