?
Solved

Multiply an Integer by a Percentage (arg!)

Posted on 2004-10-29
3
Medium Priority
?
306 Views
Last Modified: 2010-05-18
Hello,

I know this should be simple, but it's kicking my butt!
Here is what I got...

editbox1 contains a string representing a dollar amount
example = [58]

editbox6 contains a value representing a discount off of the price in editbox1
example = Discount [20] %

How do I calculate this and represent it in another string?

listview1.subitems[1].add(IntToStr(StrToInt(editbox1.text) * percentage));


Thanks!
0
Comment
Question by:TherosEquipment
3 Comments
 
LVL 1

Accepted Solution

by:
vacerose earned 150 total points
ID: 12447989
FloatToStr(StrToFloat(editbox1.text) * StrToFloat(editbox6.text) / 100)
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12448402
var
  percentage:real;
begin

percentage:=StrToFloat(editbox6.text) / 100;

listview1.subitems[1].add(IntToStr(StrToInt(editbox1.text) * percentage));
0
 

Author Comment

by:TherosEquipment
ID: 12448422
I had to modify what you did, but you pointed me in the right direction...

listitem.subitems.Add(FloatToStr(StrToFloat(flatedit4.text) * (1 - (StrToFloat(flatedit6.text) / 100))));
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
If you are looking for an automated solution for backup single or multiple Office 365 user mailboxes to Outlook data file, then you can use Kernel Office 365 Backup & Restore tool. Go through the video to check out the steps to backup single or mult…

588 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