This documentation is archived and is not being maintained.

ComponentInstaller.CopyFromComponent Method

When overridden in a derived class, copies all the properties that are required at install time from the specified component.

[Visual Basic]
Public MustOverride Sub CopyFromComponent( _
   ByVal component As IComponent _
)
[C#]
public abstract void CopyFromComponent(
 IComponent component
);
[C++]
public: virtual void CopyFromComponent(
 IComponent* component
) = 0;
[JScript]
public abstract function CopyFromComponent(
   component : IComponent
);

Parameters

component
The component to copy from.

Remarks

The installer should take all the information it can from the live component, and store it for use at install time.

Example

[Visual Basic, C#, C++] The following example defines a class MyInstallClass, which creates the event log and copies the properties of the event log component to the EventLogInstaller. It also checks whether the ServiceInstaller can perform the same kind of installation as the EventLogInstaller.

[Visual Basic] 
Dim myEventLogInstaller As New EventLogInstaller()
' Create a source for the specified event log, on local computer.
EventLog.CreateEventSource("MyEventSource", "MyEventLog", ".")
' Create an event log instance and associate it with the log .
Dim myEventLog As New EventLog("MyEventLog", ".", "MyEventSource")
' Copy the properties that are required at install time from
' the event log component to the installer.
myEventLogInstaller.CopyFromComponent(myEventLog)

[C#] 
EventLogInstaller myEventLogInstaller = new EventLogInstaller();
// Create a source for the specified event log, on local computer.
EventLog.CreateEventSource("MyEventSource","MyEventLog", ".");
// Create an event log instance and associate it with the log .
EventLog myEventLog = new EventLog("MyEventLog", ".", "MyEventSource");
// Copy the properties that are required at install time from
// the event log component to the installer.
myEventLogInstaller.CopyFromComponent(myEventLog);

[C++] 
EventLogInstaller* myEventLogInstaller = new EventLogInstaller();
// Create a source for the specified event log, on local computer.
EventLog::CreateEventSource(S"MyEventSource", S"MyEventLog", S".");
// Create an event log instance and associate it with the log .
EventLog* myEventLog = new EventLog(S"MyEventLog", S".", S"MyEventSource");
// Copy the properties that are required at install time from
// the event log component to the installer.
myEventLogInstaller->CopyFromComponent(myEventLog);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

ComponentInstaller Class | ComponentInstaller Members | System.Configuration.Install Namespace

Show: