Gets or sets the site of the Component.
[Visual Basic] Overridable Public Property Site As ISite [C#] public ISite Site {virtual get; virtual set;} [C++] public: __property virtual ISite* get_Site(); public: __property virtual void set_Site(ISite*); [JScript] public function get Site() : ISite; public function set Site(ISite);
The ISite associated with the Component, if any.
a null reference (in Visual Basic Nothing) if the Component is not encapsulated in an IContainer, or the Component does not have an ISite associated with it, or the Component is being removed from its IContainer.
Exception Type | Condition |
---|---|
InvalidOperationException | The Component is not encapsulated in an IContainer.
-or- The Component does not have an ISite associated with it. |
A Component can only have a ISite if it has been added to an IContainer and the IContainer assigns an ISite to it.
a null reference (Nothing) indicates that the Component is being removed from its IContainer; but assigning a null reference (Nothing) to this property does not necessarily remove the Component from the IContainer.
A Component may or may not have a name. If a Component is given a name, the name must be unique among other Component objects within its IContainer. The ISite stores the Component 's name; therefore, a Component can only be named if it has an ISite associated with it.
Component Class | Component Members | System.ComponentModel Namespace | IContainer | Container | ISite