Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6528265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:31:07+00:00 2026-05-25T09:31:07+00:00

Using delphi 7: How can I add an integer to the object portion of

  • 0

Using delphi 7:

  • How can I add an integer to the object portion of a stringlist item,
    using AddObject?
  • How can I retrieve the integer back from a object
    property of stringlist item?
  • How do I free all objects and list
    when done?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:31:07+00:00Added an answer on May 25, 2026 at 9:31 am

    Q: How can i add an integer to the object portion of a stringlist item, using AddObject?

    A: Just cast the integer value to TObject

    List.AddObject('A string',TObject(1));
    

    Q:How can a retrieve the integer back from a object property of stringlist item?

    A: Cast to integer the Object Value

    AValue := Integer(List.Objects[i]);
    

    Q: How do i free all objects and list when done?

    A: You don’t need free the object list, because you are not assigning memory. so only call the Free procedure of the TStringList.

    Try this sample app

    {$APPTYPE CONSOLE}
    
    uses
      Classes,
      SysUtils;
    
    
    Var
      List : TStringList;
      i    : Integer;
    begin
      try
        List:=TStringList.Create;
        try
          //assign the string and some integer values
          List.AddObject('A string',TObject(1));
          List.AddObject('Another string',TObject(100));
          List.AddObject('And another string',TObject(300));
    
          //Get the integer values back   
    
           for i:=0 to List.Count - 1 do
             Writeln(Integer(List.Objects[i]));
    
        finally
          //Free the list  
          List.free;
        end;
      except
        on E:Exception do
          Writeln(E.Classname, ': ', E.Message);
      end;
    
      Readln;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How i can parse and extract the parameters from an SQL Query using delphi?
How can I get the url from a running instance of Chrome using Delphi?
I'm using Delphi 2007. How can I put a GIF/PNG image on a BitBtn
How can I build a stand-alone SOAP-based Web Services using Delphi? Must work with
How can I detect all WiFi networks availables using Delphi? (source: filebuzz.com )
I want to monitor the copy file function using Delphi. I can do it
How i can declare a global method in delphi prism using the __Global class?
In Delphi 2009, how can I build a project using command line. I tried
I am using a DBGrid component in Delphi. I wonder how I can set
I'm working in Delphi 2007. Net, where I can find an example of using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.