About PowerBuilder .NET Windows Forms applications

PowerBuilder applications that have a rich user interface that relies on resources available on the client computer, such as a complex MDI design, graphics, or animations, or that perform intensive data entry or require a rapid response time, make good candidates for deployment as .NET Windows Forms applications. For a comparison of design considerations between Web Forms and Windows Forms applications, see “Choosing a .NET application target”.

Adapting an existing application

The changes required to transform a PowerBuilder application into a Windows Forms application depend on the nature of the application, the scripting practices used to encode the application functionality, and the number of properties, functions, and events the application uses that are not supported in the .NET Windows Forms environment.

For a list of restrictions, most of which apply to both Windows and Web Forms applications, see Chapter 14, “Best Practices for .NET Projects.”

For tables of unsupported and partially supported objects, controls, functions, events, and properties, see Chapter 11, “Unsupported Features in Windows Forms Projects.”

Setting up a target and project

You set up a target for a .NET Windows Forms application using the wizard on the Target page of the New dialog box. You can start from scratch and create a new library and new objects, use an existing application object and library, or use the application object and library list of an existing target.

You define some of the characteristics of the deployed application in the .NET Windows Forms Application wizard. Additional properties are set in the Project painter. For more information, see “Creating a .NET Windows Forms target”, “Creating a .NET Windows Forms project”, and “Setting properties for a .NET Windows Forms project”.

Smart client applications

One of the choices you can make in the wizard or Project painter is whether the application will be deployed as a smart client application. A smart client application can work either online (connected to distributed resources) or offline, and can take advantage of “intelligent update” technology for deployment and maintenance. For more information, see Chapter 10, “Intelligent Deployment and Update.”

Deploying from the Project painter

When you deploy a PowerBuilder application from the .NET Windows Forms Project painter, PowerBuilder builds an executable file and deploys it along with any PBLs, PBDs, resources, .NET assemblies, and other DLLs that the application requires. For more information, see “Deploying the project from PowerBuilder”.

Deploying to a production environment

The simplest way to deploy a Window Forms application to a production environment is to use smart client deployment. If you cannot or do not want to use smart client deployment, use the following procedure to install the application.

StepsTo deploy a .NET Windows Forms application:

  1. Install the .NET Framework 2.0 on the target computer.

  2. Generate a PowerBuilder .NET components MSI file using the PowerBuilder Runtime Packager.

    For more information about using the Runtime Packager, see the chapter on deploying applications and components in Application Techniques.

  3. Install the generated MSI file on the target computer and restart the computer.

  4. Copy the output from the build directory to the target computer.

  5. Install any required database client software and configure related DSNs.

  6. If necessary, register ActiveX controls used by your application.

Using preprocessor symbols

If you share PBLs among different kinds of target, such as a target for a standard PowerBuilder application and a Windows Forms target, you might want to write code that applies to a specific target. For example, use the following template to enclose a block of code that should be parsed by the pb2cs code emitter in a Windows Forms target:

#if defined PBWINFORM then
	/*action to be performed in a Windows Forms target*/
#else
	/*other action*/
#end if

You can use the Paste Special>Preprocessor pop-up menu item in the Script view to paste a template into a script.

For more information about using preprocessor symbols, see “About conditional compilation”.