Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

validation of currency fields

drlawdrlaw Member Posts: 11
hi,

i need code to validate an edit box so that it only allows for numeric(currency) data eg 50.99

thanks.

Comments

  • FactorSoftwareFactorSoftware Member Posts: 19
    : hi,
    :
    : i need code to validate an edit box so that it only allows for numeric(currency) data eg 50.99
    :
    : thanks.
    :

    Instead of using an EditBox, try using an MaskEdit Component!
    In the EditMask property of the MaskEdit write something like this: '0.##', for more types of mask, try browsing the help files!

    Good Luck, and Goodbye!


  • injektiloinjektilo Member Posts: 113
    [code]
    var
    A: Currency;
    begin
    try
    A := StrToFloat(Edit1.Text);
    except
    //no currency code, some message or something else
    end;
    end;
    [/code]

    or this

    [code]
    var
    A: Currency;
    begin
    A := StrToFloatDef(Edit1.Text, 0); //default zero when no currency
    end;
    [/code]

  • Shawn CarterShawn Carter Member Posts: 0

    ______ // http://forcoder.org // free ebooks and video tutorials about // JavaScript Python Java Go MATLAB C++ C R C# Swift PL/SQL Perl Visual Basic Objective-C Assembly Scratch Visual Basic .NET Delphi Ruby PHP Logo ABAP VBScript Julia Scala Rust SAS Awk F# LabVIEW Crystal Bash ML Scheme Kotlin Fortran Lisp D Ada Dart Alice FoxPro Lua Clojure Transact-SQL Prolog Erlang Apex COBOL Hack // __

Sign In or Register to comment.