Multiply an Integer by a Percentage (arg!)

Posted on 2004-10-29
Last Modified: 2010-05-18

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));

Question by:TherosEquipment
    LVL 1

    Accepted Solution

    FloatToStr(StrToFloat(editbox1.text) * StrToFloat(editbox6.text) / 100)
    LVL 13

    Expert Comment


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

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

    Author Comment

    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))));

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    884 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

    21 Experts available now in Live!

    Get 1:1 Help Now