There is not example on document 2005

Posted on 2005-04-26
Last Modified: 2011-10-03
Dear advisor !

I use Delphi 2005

I want know the example about using VAL function. But there is not example about this function. On document D2005, there is no any examlpe like D6, D7

So i should download document from

Is not example from document D2005 ? Example about Val and str funtion
Question by:namcit99
    LVL 5

    Expert Comment

    To the best of my knowledge the Val function works the same in 2005 as it did in previous versions. The example from the D7 help file is:

    uses Dialogs;

      I, Code: Integer;
      { Get text from TEdit control }
      Val(Edit1.Text, I, Code);
      { Error during conversion to integer? }
      if Code <> 0 then
        MessageDlg('Error at position: ' + IntToStr(Code), mtWarning, [mbOk], 0, mbOk);
        Canvas.TextOut(10, 10, 'Value = ' + IntToStr(I));


    Is that what you wanted?

    Author Comment


    now, I already know to use about Val function. I complaint about document D2005. I want to read example , but nothing.
    LVL 5

    Accepted Solution

    So you actually want to find the complete 2005 documentation online? Sorry, I don't think it is available.

    Author Comment


    i am studying using Delphi. so i should use ducument so much when coding. IT is not suitablr for beginner with document D2005. because no example for function.
    LVL 5

    Expert Comment

    Firstly, both "Val" and "Str" are procedures not functions.

    Secondly, they are both very "old" and both have better modern alternatives.

    Really, for "Val" you would be much better off using the "StrToIntDef" or "StrToInt64Def" functions, where you could do something like this;


    with the added bonus of not needing to worry about numeric range limits or invalid characters in "MyNumberInStr" raising exceptions.

    and for "Str" you would be better off using the "Format" function, like this;


    the "Format" function can deal with, pretty much, any kind of variable(s) in many ways, the "Format" function is very powerful and very flexible.


    LVL 5

    Expert Comment

    ...although Val has the added functionality of returning the offending character position in the case of failure, which sets it apart from StrToIntDef or StrToInt.

    Author Comment


    I consider on your idea

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    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…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    755 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