Partager via


How to: Copy Classes Between Class Libraries

You can copy classes between class libraries. You can copy classes using Class Browser, the Project Manager when the class libraries are parts of projects though not necessarily the same project, or programmatically.

To copy a class between class libraries

  1. Open the class library containing the class you want to copy in the Class Browser.

    For more information about opening class libraries, see How to: Open Class Libraries.

  2. Open the destination class library in another instance of the Class Browser.

  3. In the Class Browser containing the source class library, select the class you want to copy.

  4. Press and hold the CTRL key while you drag the class icon above the class list to the destination class library.

    A plus (+) sign appears above the cursor when you drag the class icon into the destination class library.

Tip

To move a class from one class library to another, do not press and hold the CTRL key while dragging the class icon.

To copy a class between class libraries in projects

  1. Open the project or projects containing the class libraries.

  2. In the Project Manager, select the Classes tab.

  3. Expand the class library containing the class you want to copy and the destination class library.

  4. Drag the class to the destination library.

    The mouse pointer changes into a class library icon when you move it over a valid destination library.

To copy classes between class libraries programmatically

  • Use the ADD CLASS command with the OF clause.

For example, the following line of code copies the class MyClass from MyClassLibrary1 to MyClassLibrary2.

ADD CLASS MyClass OF MyClassLibrary1 TO MyClassLibrary2

For more information, see ADD CLASS Command.

See Also

Other Resources

Managing Classes and Class Libraries