Click here to Skip to main content
13,142,784 members (53,443 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 18 Aug 2013

Call C# assembly and its method in PowerBuilder

, 18 Aug 2013
Rate this:
Please Sign up or sign in to vote.
Call C# class and its method in PowerBuilder 11.


Call method from C# class file/DLL in PowerBuilder 11.

Using the code 

If you use .NET target of PB 11, you can call a C# class using a .NET assembly. 

C# class DLL:


using System;
using System.Collections.Generic; 
using System.Text; 
using System.Runtime.InteropServices; 

namespace ClassLibrary1 
    public class Calc
        public int Add(int x, int y)
            return x + y; 
        public int Sub(int x, int y)
            return x - y; 


In the .NET Windows form target, define the DLL above as a .NET assembly. Now you can call the DLL. Here is the PowerBuilder script:

long i,j,k 
i = 5 
j = 4 
 #IF Defined PBDOTNET Then 
         ClassLibrary1.Calc l_ClassLibrary1  
     l_ClassLibrary1 = create ClassLibrary1.Calc 
          k =                 l_ClassLibrary1.Add( i,j) 
 messagebox("Add( i,j)",string(k)) 


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
India India
Musakkhir Sayyed is a Software Engineer working in IT Company. He has been a programmer/Software Developer for past 5 years specializing in .NET/C# development.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170915.1 | Last Updated 18 Aug 2013
Article Copyright 2013 by Musakkhir
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid