Board index » delphi » derefencing Sender:TObject

derefencing Sender:TObject

Hi,
the compiler complains in the following code:

procedure Edit1Click(Sender:TObject)
  Edit2.Text := Sender.Text;

but not in the following:

  Edit2.Text := Edit1.Text;

or

  Edit2.Text := Sender.ClassName;

why?  Why can't Sender be identified as the instance Edit1 ?

 

Re:derefencing Sender:TObject


Try this

 Edit2.Text := (Sender as TEdit).Text;
===============================================================
Name:    Reza Bin Raquib            Phone : 667-3000 x 227
Company: SYSTEMS 2000               E-Mail: RRAQ...@PANIX.COM
"For off-shore pricing on Printing, Data entry, CAD conversion,
 and Software development project please call."
===============================================================

Other Threads