Share via


How to: Modify Classes

After you create a class, you can make changes to the class. Changes that you make to the class propagate to all subclasses and objects based on the class. For example, suppose you add an enhancement to a class or fix a bug in the class. All the subclasses and objects based on the class inherit the change.

Warning

If the class is being used in any other application components, do not change the Name property of the class. Otherwise, Visual FoxPro will not be able to locate the class when it is needed.

You can modify classes by opening the Class Designer through the Visual FoxPro IDE, the Class Browser, the Project Manager if the class is part of a project, or programmatically.

To modify a class

  1. On the File menu, choose Open.

  2. In the Files of type box in the Open dialog box, select the class library you want to open, and click OK.

    An Open dialog box appears for you to select a class from the class library you opened.

  3. In the Class Name list of the Open dialog box, select a class, and click Open.

    The class you selected opens in the Class Designer.

    -OR-

  4. In the Class Browser, open the class library you want.

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

  5. In the class list, right-click the class and choose Modify.

    The class you selected opens in the Class Designer.

To modify a class in a project

  1. Open the project containing the class you want.

  2. In the Project Manager, select the class you want, and click Modify.

    The class you selected opens in the Class Designer.

You can also modify classes in visual class library (.vcx) files using the MODIFY CLASS command to open the Class Designer.

For example, typing the following line in the Command window opens the class MyClass, which is stored in the class library MyClassLibrary, in the Class Designer so you can modify it:

MODIFY CLASS MyClass OF MyClassLibrary

For more information, see MODIFY CLASS Command.

See Also

Tasks

How to: Add Properties to Classes

How to: Add Methods to Classes

Concepts

Classes in Visual FoxPro

Working with Classes in Visual FoxPro