Condividi tramite


How to: Rename Classes in Class Libraries

You can rename classes in class libraries. You can rename classes in class libraries using the Class Browser, the Project Manager when the class library is part of a project, or programmatically.

Warning

When you rename a class, forms that contain that class and subclasses in other class libraries continue to refer to the original name and will no longer function correctly.

Tip

If you rename a class using the Class Browser when all associated subclasses and forms are open in the Class Browser, the new name is automatically referenced in all affected subclasses and forms.

To rename a class in a class library

  1. Open the class library in the Class Browser.

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

  2. In the class list of the Class Browser, select the class you want rename, and click the Rename button.

  3. In the Rename dialog box, type the new name, and click Rename.

    The class list in the Class Browser displays the renamed class.

For more information, see Class Browser Window.

To rename a class in a project

  1. Open the project containing the class library with the class you want to rename.

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

  3. Expand the class library containing the class you want to rename.

  4. Right-click the class library and choose Rename.

  5. In the To: box of the Rename File dialog box, type a new name for the class.

  6. Click OK.

To rename classes programmatically

  • Use the RENAME CLASS command.

For example, the following line of code changes the name of the class MyClass in the class library MyClassLibrary to YourClass:

RENAME CLASS MyClass OF MyClassLibrary TO YourClass

For more information, see RENAME CLASS Command.

See Also

Other Resources

Managing Classes and Class Libraries