Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Try to create a component with a TStrings property

Posted on 2002-03-23
1
Medium Priority
?
298 Views
Last Modified: 2010-04-05
I try to create a comonent
When i put the component on a form and click on nstring I get an Abstract Error.


unit Str;
interface
uses
  Windows, Messages, SysUtils, Classes, StdCtrls;
type
  TStr = class(TComponent)
  private
  protected
    astring : TStrings;
  public
    constructor Create(AOwner: TComponent);  override;
    destructor Destroy; override;
  published
    property nstring: TStrings READ astring WrITE astring;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TStr]);
end;

constructor TStr.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  astring := TStrings.Create;
end;

destructor TStr.Destroy;
begin
 inherited Destroy;
end;

end.
0
Comment
Question by:delpro
[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
1 Comment
 
LVL 9

Accepted Solution

by:
ITugay earned 200 total points
ID: 6890631
Hi delpro,


1. Do not use TStrings.Create, use TStringList.Create instead.

astring := TStringList.Create;

2. property nstring: TStrings READ astring WrITE astring;

should be changed to

property nstring: TStrings READ astring  write SetAstring;

procedure TStr.SetAString(Value: TStrings);
begin
  astring.Text := Value.Text;
  // or astring.Assign(Value);
end;

-----
Igor.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

618 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