If you use .NET target of PB 11, you can call C# class using .NET
Assembly.
C# class dll
-------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace ClassLibrary1
{
[ClassInterface(ClassInterfaceType.AutoDual)]
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.
Power Builder 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)
#END IF
messagebox("Add( i,j)",string(k))
-------------------------------------------------------------------------------------
Assembly.
C# class dll
-------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace ClassLibrary1
{
[ClassInterface(ClassInterfaceType.AutoDual)]
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.
Power Builder 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)
#END IF
messagebox("Add( i,j)",string(k))
-------------------------------------------------------------------------------------
No comments :
Post a Comment