## Recommended Posts

vtbones    122
I'm new to MFC and I'm trying to work with an edit box that needs to contain a dollar amount. As of right now, I'm trying to do this with a CString type variable. Is there a built-in/simple way to maintain the proper format of $xx.xx (w/o the$) using the CString type. In basic C++, I would just use a double set with a precision of 2 but I dont know if something like this can be done with MFC applications. Thanks in advance!

##### Share on other sites
SiCrane    11839
IIRC, if you wanted to load 10 dollars and 30 cents as the string it'd go like:
  CString str;  str.Format("%2.2f", 10.3);

For more details check out the MSDN help files for CString::Format().