Problem with numbers in French on a Delphi program

Posted on 2006-05-24
Last Modified: 2010-04-05

I have a program with a combo box that has decimal values from .40 to 1.0.  A user selects this as a selling multiplier for products.  If you select .60 in the combo box, then another edit box displays the selling multiplier at four decimal places, (.6000 in this case.)  

This works great in English.  But if the user changes the Regional Setting to French(Canada) in the Control Panel, I run into problems.  Now, when you select .60 in the box, 60,0000 shows up in the selling mulitplier edit box.  It's as if it's disregarding the decimal in the combo box.

Any ideas on how I can resolve this?

Question by:light_bulb
    LVL 10

    Accepted Solution

    Hi there,

    This should solve you problem:

      USAFormat: TFormatSettings = (
        DecimalSeparator: '.'

    procedure TForm1.ComboBox1Change(Sender: TObject);
      lnNumber: Double;
      if ComboBox1.ItemIndex = -1 then
        lnNumber := 0
        lnNumber := StrToFloat(ComboBox1.Text, USAFormat);
      Edit1.Text := FloatToStrF(lnNumber, ffFixed, 15, 4);

    Regards Jacco
    LVL 3

    Author Comment

    Not sure if that will work or not, I've since found an answer myself.  I had to clear the combo and then repopulate it, replaceing the decimal points with commas.

    Thanks though.
    LVL 10

    Expert Comment

    Hi there,

    That is the other option. Thanks for the points though.

    Regards Jacco

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    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…
    Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    732 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

    22 Experts available now in Live!

    Get 1:1 Help Now