Jump to content
  • Advertisement
Sign in to follow this  
vtbones

MFC question about CString

This topic is 5221 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 this post


Link to post
Share on other sites
Advertisement
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().

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!