Solved

Function with a TStrings result

Posted on 2000-03-22
3
326 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
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

12 Experts available now in Live!

Get 1:1 Help Now