Inheriting from a .NET Class

You can create a nonvisual user object that inherits from a .NET class in the same way that you create an object, visual or nonvisual, that inherits from a PowerBuilder object.

Prerequisites
Before you can create an object that inherits from a .NET class in an assembly, you must add the assembly as a target reference.
Task

To inherit from a .NET class defined in an assembly listed in the target References folder:

  1. Select File > Inherit from the PowerBuilder .NET menu, or click Inherit in the IDE toolbar.
    Note: Alternatively, you can expand the node for an assembly in the References folder of your target to show the class you want to inherit from, right-click the class, select Inherit From, and skip to step 6.
  2. In the Inherit from Object dialog box, select the target where you want to add the new object.
  3. Select Classes or All Objects as the object type.
  4. From the Libraries list, select an assembly containing the class you want to inherit from.
  5. From the Objects list, select the class you want to inherit from and click OK.
  6. In the Object painter, implement all abstract and virtual functions, interfaces, events, indexers, and .NET properties defined in the base class.
  7. In the new object, add interfaces, functions, events, indexers, .NET properties, and parameterized constructors as for any other object.
    Note: By default, the new nonvisual user object extends the default (parameterless) constructor of its base .NET class. However, if the base .NET class has only parameterized constructors, you must manually call one of these constructors from a constructor of the new object:
       super::Constructor (parameters)