Board index » delphi » Passing TMemoField as a TStringList parameter to a procedure
R. Mittendorff
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
R. Mittendorff
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Passing TMemoField as a TStringList parameter to a procedure
I created a procedure that print the lines in a TStringList (or TStrings). procedure PrintStringList(Items: TStringList); How can I pass a TMemoField to this procedure. Finally I build a 'wrapper' for a MemoField. var This worked out but means a lot of code for a simple action. Thanks |
Steve Koters
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Passing TMemoField as a TStringList parameter to a procedureQuoteOn Fri, 29 Jan 1999 19:48:29 +0100, "R. Mittendorff" <r...@xs4all.nl> wrote: TField. That they are assignment-compatible is merely a factor of how the Assign method of each is implemented. It is because of a lack of a closely related ancestor that one cannot be passed as the other in a parameter. One thing you might consider is typeing the parameter as an ancestor class procedure PrintStringList(Items: TPersistent); ////////////////////////////////////////////////////////////////////////// |
Roland Salzburge
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Passing TMemoField as a TStringList parameter to a procedureR.: Try "PrintStringList(MyMemoField.Lines);" Lines is a TStringList as well as the one you used in your workaround. Quote> I created a procedure that print the lines in a TStringList (or Roland Salzburger |
R. Mittendorf
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Passing TMemoField as a TStringList parameter to a procedureRoland, which version of Delphi do you work with? In Delphi 4 the TMemoField has not a property Lines. Bye, R. Mittendorff the Netherlands Roland Salzburger heeft geschreven in bericht Try "PrintStringList(MyMemoField.Lines);" Lines is a TStringList as well as the one you used in your workaround. Quote> I created a procedure that print the lines in a TStringList (or Roland Salzburger |
Michael Burt
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Passing TMemoField as a TStringList parameter to a procedureQuote>How can I pass a TMemoField to this procedure. PrintStringList(MyMemoField.AsString); Michael Burton |
R. Mittendorf
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Passing TMemoField as a TStringList parameter to a procedureMichael, thanks for your reaction. I tried it, but AsString returns a string type; this is not compatible with. Bye, Michael Burton heeft geschreven in bericht Quote>>How can I pass a TMemoField to this procedure. |
Christian Wallne
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Passing TMemoField as a TStringList parameter to a procedureIt is not possible to assign TMemoField to TStringList. Further, there is no TStrings or TStringList compatible property defined in TMemoField. If PrintStringList wants a string list, why not give one to it? List := TStringList.Create; Another tip: function PrintStringList(AText: string): Boolean; Now it is easy: if PrintStringList(MyMemoField.AsString) then... Hope that will help. Quote>>How can I pass a TMemoField to this procedure. |
1. Passing a pointer to a procedure/function as a parameter in a procedure
2. Passing Procedures as Parameters in TP 7.0
3. Passing parameters to stored procedure.
4. Passing blob parameter to stored procedure
5. Passing NULL parameters to a stored procedure
6. Delphi2.0 Stored Procedure Parameter passing as LongString
7. passing pointers as procedure parameters
8. Parameters passed to procedure or function
9. How to pass Database Name Parameter to SQL Server Procedure from ADOCommand
10. passing array as a parameter back to the oracle 8i stored procedure