Re:"TButton(Sender)" and "(Sender as TButton)"
Quote
>I agree that you should always use the first method when you can.
>However there are many instances where you need something as something
>else and can't use as. This mainly occurs when you are converting
>to/from something that is not a descendant from TObject.
Another example of when you can't use the 'as' construct is if the object you
are referring to is in an array. If you use the objects property of a
TStringList, for example, to operate on those objects, the following line fails:
(myList.Objects[0] as TmyObject).MyMethod() ;
while this line works fine:
TmyObject(myList.Objects[0]).MyMethod() ;
--
Clayton Neff
Software Project Leader
The Personal Marketing Company, Inc.
11843 West 83rd Terrace
Lenexa, KS 66214
(913)492-0322
clay...@tpmco.com