Solved

Function with a TStrings result

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

690 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