Solved

Function with a TStrings result

Posted on 2000-03-22
3
335 Views
Last Modified: 2010-05-18
I need to write a function with a TStrings result. I would really appreciate some examples.
0
Comment
Question by:skymag
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Accepted Solution

by:
Motaz earned 50 total points
ID: 2644448
function GetList: TStrings;
begin
  Result:= TStringList.Create;
  Result.CommaText:= 'First,Second,Third';
end;

//How to use it:

procedure TForm1.Button1Click(Sender: TObject);
var
  MyList: TStrings;
begin
  MyList:= GetList;
  ShowMessage(MyList.Text);
end;


Motaz
0
 
LVL 3

Expert Comment

by:markshiffer
ID: 2644668
Its better to use a procedure with a var param when passing objects. Just thought I would tone that in. I've been in the same place of needing to pass an object back as the result of a function and it is much more trouble than it is worth...
0
 

Author Comment

by:skymag
ID: 2644691
Thanx!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert a string into a TDateTime 5 72
Performance of SQL statement 37 137
Firemonkey BASS_Init into a thread 17 55
Broadcast a message using ICS 2 26
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

733 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