Solved

Format INT into Money

Posted on 2004-10-13
5
199 Views
Last Modified: 2012-05-05
Hi there,
I have an integer that I would like to convert to dollars and display in a label caption "2000 => $2,000" (no cents) whats the easiest way of doing so?

Thank you
0
Comment
Question by:maxb
  • 2
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
LRHGuy earned 50 total points
ID: 12303048
Try:

var
  I:integer=2000;

Label.Caption:=Format('%.0m',[I*1.0]);
0
 

Author Comment

by:maxb
ID: 12303115
Does that add the dollar sign? I dont have Delphi to test for a couple more hours...
0
 
LVL 7

Expert Comment

by:LRHGuy
ID: 12303193
It put the dollar sign when I tested it.

You can add the dollarsign in front if needed.

'$'+Format

0
 
LVL 2

Expert Comment

by:-Karamja-
ID: 12303240
For me it added £, Guess it could be on settings of pc
0
 

Author Comment

by:maxb
ID: 12407611
How do I convert the money back out into an integer?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

777 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