Did you try casting TPanel to TComponent?
DJS
--- heromed <[EMAIL PROTECTED]> wrote:
> {Copied from Delphi(6) help}
>
> function ComponentToString(Component: TComponent):
> string;
> var BinStream:TMemoryStream;
> StrStream: TStringStream;
> s: string;
> begin
> BinStream := TMemoryStream.Create;
> try
> StrStream := TStringStream.Create(s);
> try
> BinStream.WriteComponent(Component);
> BinStream.Seek(0, soFromBeginning);
> ObjectBinaryToText(BinStream, StrStream);
> StrStream.Seek(0, soFromBeginning);
> Result:= StrStream.DataString;
> finally
> StrStream.Free;
> end;
> finally
> BinStream.Free
> end;
> end;
>
> function StringToComponent(Value: string):
> TComponent;
> var StrStream:TStringStream;
> BinStream: TMemoryStream;
> begin
> StrStream := TStringStream.Create(Value);
> try
> BinStream := TMemoryStream.Create;
> try
> ObjectTextToBinary(StrStream, BinStream);
> BinStream.Seek(0, soFromBeginning);
> Result := BinStream.ReadComponent(nil);
> finally
> BinStream.Free;
> end;
> finally
> StrStream.Free;
> end;
> end;
>
> procedure TForm1.Button1Click(Sender: TObject);
> var Str : string;
> begin
> Str := ComponentToString(Panel1);
> Panel2 := StringToComponent(Str); // the line
> with the error
> end;
>
> When compiling, I get the following error:
>
> "Incompatible types: 'TPanel' and 'TComponent'"
>
> Can anyone help ??, or provide alternative code to
> save Component
> Properties.
>
>
>
>
>
>
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~->
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/