RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TComponent.SetName Method

Sets the value of the Name property.

Pascal
procedure SetName(const NewName: TComponentName); virtual;
C++
virtual __fastcall SetName(const TComponentName NewName);

SetName is the virtual property setter for the Name property. It calls the ChangeName method, which performs the actual name change. 

ChangeName is not virtual; override SetName instead when modifying the behavior of the Name property.

Warning: Using SetName to change the name of a component at runtime causes any references to the old name to become undefined. Any subsequent code that uses the old name will cause an exception.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!