You'll need Microsoft Visual Studio (in this case, I'm using version 2005 with .NET 2.0 framework). And also, you must download Interop Forms Toolkit version 2.1 at Microsoft MSDN site.
The Interop Forms Toolkit 2.1 is a free Visual Studio add-in that simplifies the process of displaying .NET forms and controls in a Visual Basic 6 application. Instead of upgrading the entire code base, these applications can now be extended one form at a time. The goal is a phased upgrade, with production releases at the end of each iteration containing both Visual Basic 6 and Visual Basic .NET forms running in the same Visual Basic 6 process.
Close your VS2005 before you install the Interop Form Toolkit.
Since almost all the objects which made for Visual Basic 6, can used by Powerbuilder application, I'm sure we can use this technique in Powerbuilder too.
Now, here's the steps
Creating .NET Object
- Open VS, and create new project with Project Type: Windows, and template: VB6 Interop UserControl
- You'll see like figure above, at the Solution Explorer windows.
- Open InteropUserControl.vb and create an application. You can use the third party object too.
- Save and try to rebuild and run the application by pressing F5 button.
- That's all for the creating .NET object.
Using .NET Object in Powerbuilder
- Open your Powerbuilder. I'm using version 6.5 in this example.
- Create new application, then create new window.
- Insert OLEObject into the new window. You should see the InteropUserControlLibrary1 object in INSERT CONTROL tab. If you can't see the object, do the registering system.dll step. See at the bottom of this article to do that.
- Choose the InteropUserControlLibrary1 object and place somewhere inside the window.
- Save and try to run the application.
- Now, you have .NET object in your Powerbuilder application.
Registering the system.dll so that it can be used from Powerbuilder
- Navigate to Start | Run.
- In the Run dialog, enter CMD, and click OK.
- Enter cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727.
- Enter regasm system.dll.
Hi,
ReplyDeleteI recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading.
Nice blog. I will keep visiting this blog very often.
-
PowerBuilder Application development