Solved

MFC: formatting numeric field

Posted on 2007-04-02
2
255 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
Comment Utility
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
Comment Utility
You can use the COleCurrency class to convert monetary values in a standard way.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

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 …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 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

8 Experts available now in Live!

Get 1:1 Help Now