Calling .NET Assembly

PowerBuilder applications can directly call .NET assemblies, via two objects: DotNetAssembly and DotNetObject. DotNetAssembly is used to load the .NET assembly, and DotNetObject is used to map to the .NET class in the assembly. After you create DotNetAssembly and DotNetObject instances in PowerBuilder, you can directly call the functions defined in the .NET class.

To help developers write scripts in a more productive way, a tool called ".NET DLL Importer" is provided to help developers write scripts to correctly call functions in the .NET class. .NET DLL Importer can import the names and data types of the .NET classes, functions, properties, and parameters from the .NET assembly to the application PBL. It creates the DotNetObject object as an NVO for each .NET class and then imports the .NET functions to the NVO. After that the developer can write scripts to call the NVO and function directly to execute the corresponding .NET code.

For more details, refer to the section called “Calling .NET Assembly in an Application” in Application Techniques, the section called “DotNetAssembly object” in Objects and Controls, and the section called “DotNetObject object” in Objects and Controls.