Link to home
Start Free TrialLog in
Avatar of ikaros23
ikaros23

asked on

Problem in a Component derived from TClientDataSet using TStrings

Hello ,

      I want to create a Custom Component based on the TClientDataset class. I want my new component to be able to hold some strings in a TstringList. I have used the same technique in some other components and worked fine. No when I am trying to open the TStrings Editor in the Object Inspector the following error message appears "Could not assign a nil to a TRichEditStrings". What may be wrong ?

Thank you in advance.
TMySecondClientDataset = class(TClientDataSet)
  private
    FFileGroups: TStrings;
  protected
    constructor Create(AOwner : TComponent);
    destructor Destroy;
  public
  published
    property FileGroups: TStrings read FFileGroups write FFileGroups;
  end;
 
constructor TMySecondClientDataset.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FFileGroups := TStringList.Create;
end;
 
destructor TMySecondClientDataset.Destroy;
begin
  FFileGroups.Free;
end;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ikaros23
ikaros23

ASKER

I tried your solution but nothing happened :(. In another component that I have created (derived from TADOQuery) The same technique worked fine . Why would I need a setter procedure in this one ? I am very confused :( ......
did you assign nil ?

you want to assign the content of the list ,
not the list itself
Your setter procedure was right. What I though was right in the components I told you I have used the same technique proved to be wrong.I had written a property editor to access the strings . when I used the default the same error occurred. Although I have used a slightly different approach than the one you suggested (taken by FSQL property of ADOQuery) , I am accepting your solution , because its essentially the same. Thank you very much,
but why then a B grade ?
Sorry for the B . I am new to the experts and placed a B by mistake ... SORRYYYY :(
lol, no need to apologize, i was just wandering why ...
just follow the guide lines.
post a A, when accept,
post a B when you had to solve yourself and further investigation didn't help
post a C ... nobody likes this ...