Vous êtes sur la page 1sur 120

Visual Studio Tools for Microsoft Dynamics GP

Programmers Guide
Release 10

Copyright

Copyright 2008 Microsoft Corporation. All rights reserved. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Notwithstanding the foregoing, the licensee of the software with which this document was provided may make a reasonable number of copies of this document solely for internal use.

Trademarks

Microsoft, Dexterity, Microsoft Dynamics, Visual Basic, Visual Studio, Windows, Windows Server, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation or its affiliates in the United States and/or other countries. The names of actual companies and products mentioned herein may be trademarks or registered marks - in the United States and/or other countries - of their respective owners. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred.

Intellectual property

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. Microsoft Corporation disclaims any warranty regarding the sample code contained in this documentation, including the warranties of merchantability and fitness for a particular purpose. The content of this document is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Microsoft Corporation. Microsoft Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in this manual. Neither Microsoft Corporation nor anyone else who has been involved in the creation, production or delivery of this documentation shall be liable for any indirect, incidental, special, exemplary or consequential damages, including but not limited to any loss of anticipated profit or benefits, resulting from the use of this documentation or sample code. Use of this product is covered by a license agreement provided with the software product. If you have any questions, please call the Microsoft Dynamics GP Customer Assistance Department at 800-456-0025 (in the U.S. or Canada) or +1-701-281-6500.

Warranty disclaimer

Limitation of liability

License agreement

Publication date

September 2008

Contents
Introduction ................................................................................................................................................. 2
Whats in this manual...................................................................................................................................2 Whats new in this release of Visual Studio Tools....................................................................................2 Prerequisites...................................................................................................................................................3 Symbols and conventions ............................................................................................................................3 Product support ............................................................................................................................................3

Part 1: Getting Started ................................................................................................................. 6


Chapter 1: SDK Installation ........................................................................................................ 7
Installation procedure ..................................................................................................................................7 Template registration....................................................................................................................................8 What was installed........................................................................................................................................9 Upgrading to Visual Studio 2008................................................................................................................9

Chapter 2: Integration Basics.................................................................................................. 11


What Visual Studio Tools provides .......................................................................................................... 11 Architecture ................................................................................................................................................. 11 Creating a project ........................................................................................................................................12

Chapter 3: Upgrading an Integration .............................................................................. 15


C# integration ..............................................................................................................................................15 Visual Basic integration..............................................................................................................................17

Part 2: Developing Integrations ................................................................................... 20


Chapter 4: WinForms ...................................................................................................................... 21
Adding a Dynamics GP form to a project ...............................................................................................21 WinForm properties....................................................................................................................................22 Adding controls...........................................................................................................................................23

Chapter 5: Control Reference ................................................................................................ 25


Buttons..........................................................................................................................................................25 TextBoxes......................................................................................................................................................27 Labels ............................................................................................................................................................28 ComboBoxes ................................................................................................................................................28 ListBoxes ......................................................................................................................................................28

Chapter 6: Dictionary Assembly Generator .............................................................. 29


Creating application assemblies ...............................................................................................................29 Output files ..................................................................................................................................................29 Using the Dictionary Assembly Generator .............................................................................................30 Optimizing the assembly generating process.........................................................................................32

Chapter 7: Accessing Dictionary Resources ............................................................ 33


Adding references.......................................................................................................................................33 Namespace...................................................................................................................................................34

PROGRAMMERS

GUIDE

C O N T E N T S

Dictionary class ...........................................................................................................................................34 Accessing additional resources .................................................................................................................35 Variables for dictionary resources ............................................................................................................35

Chapter 8: Events .............................................................................................................................. 37


Registering events.......................................................................................................................................37 Responding to events .................................................................................................................................39

Chapter 9: Working with Tables ........................................................................................... 41


Tables in Microsoft Dynamics GP.............................................................................................................41 Table buffers.................................................................................................................................................42 Opening and closing tables .......................................................................................................................43 Keys...............................................................................................................................................................44 Retrieving a row..........................................................................................................................................44 Saving a row ................................................................................................................................................45 Updating a row ...........................................................................................................................................46 Removing a row ..........................................................................................................................................47 Table operation errors ................................................................................................................................48 Ranges...........................................................................................................................................................49 Row locking .................................................................................................................................................53 Multiuser processing ..................................................................................................................................53

Chapter 10: Building and Deploying ................................................................................ 59


Setting assembly information....................................................................................................................59 Building an integration ..............................................................................................................................60 Deploying an integration...........................................................................................................................61

Chapter 11: Debugging ................................................................................................................. 63


Preparing to debug .....................................................................................................................................63 Examining the application.........................................................................................................................64 Disabling events ..........................................................................................................................................64

Chapter 12: Modified and Alternate Forms............................................................... 65


Modified forms............................................................................................................................................65 Alternate forms ...........................................................................................................................................66 Guidelines ....................................................................................................................................................67

Part 3: Resource Reference ................................................................................................ 70


Chapter 13: Forms............................................................................................................................. 71
Accessing forms ..........................................................................................................................................71 Form methods .............................................................................................................................................71 Form properties...........................................................................................................................................73 Form events .................................................................................................................................................74

Chapter 14: Windows ..................................................................................................................... 75


Accessing windows ....................................................................................................................................75 Window methods........................................................................................................................................75 Window properties .....................................................................................................................................75 Window events............................................................................................................................................76

ii

P R O G R A M M E R S

G U I D E

C O N T E N T S

Chapter 15: Scrolling Windows ............................................................................................ 77


Accessing scrolling windows ....................................................................................................................77 Scrolling window methods........................................................................................................................77 Scrolling window properties.....................................................................................................................77 Scrolling window events............................................................................................................................77

Chapter 16: Window Fields ....................................................................................................... 81


Accessing window fields ...........................................................................................................................81 Window field methods...............................................................................................................................81 Window field properties ............................................................................................................................83 Window field events...................................................................................................................................84

Chapter 17: Tables ............................................................................................................................ 85


Accessing tables ..........................................................................................................................................85 Table methods..............................................................................................................................................86 Table properties ...........................................................................................................................................89

Chapter 18: Table Fields .............................................................................................................. 91


Accessing table fields .................................................................................................................................91 Table field methods.....................................................................................................................................91 Table field properties ..................................................................................................................................92

Chapter 19: Commands ............................................................................................................... 93


Command types ..........................................................................................................................................93 Accessing commands .................................................................................................................................93 Command methods ....................................................................................................................................93

Chapter 20: Globals ......................................................................................................................... 95


Accessing globals ........................................................................................................................................95 Global properties.........................................................................................................................................95

Chapter 21: Procedures ............................................................................................................... 97


Accessing global procedures .....................................................................................................................97 Accessing form-level procedures..............................................................................................................97 Procedure methods.....................................................................................................................................97 Invokable procedures .................................................................................................................................98

Chapter 22: Functions ................................................................................................................... 99


Accessing global functions ........................................................................................................................99 Accessing form-level functions.................................................................................................................99 Function methods .....................................................................................................................................100 Invokable functions ..................................................................................................................................100

Part 4: Integration Examples ........................................................................................ 102


Chapter 23: Field Defaulter ................................................................................................... 103
Overview....................................................................................................................................................103 Running the sample application.............................................................................................................103 How Visual Studio Tools was used ........................................................................................................104

PROGRAMMERS

GUIDE

iii

C O N T E N T S

Chapter 24: Estimate Freight............................................................................................... 105


Overview....................................................................................................................................................105 Running the sample application.............................................................................................................105 How Visual Studio Tools was used ........................................................................................................106

Glossary ..................................................................................................................................................... 109 Index ................................................................................................................................................................ 111

iv

P R O G R A M M E R S

G U I D E

INTRODUCTION

Introduction
Welcome to Visual Studio Tools for Microsoft Dynamics GP. This documentation explains how to integrate applications you create with Visual Studio into Microsoft Dynamics GP. Before you begin creating an integration for Microsoft Dynamics GP, take a few moments to review the information presented here.

Whats in this manual


The Visual Studio Tools for Microsoft Dynamics GP Programmers Guide is designed to give you an in-depth understanding of how to use these tools to create an application that integrates with Microsoft Dynamics GP. Even if you are familiar with using Visual Studio to develop applications, you will find it helpful to browse the material presented here. Information is divided into the following parts: Part 1, Getting Started, explains how to install Visual Studio Tools for Microsoft Dynamics GP and begin creating an integration. Part 2, Developing Integrations, provides detailed information about creating WinForms that match the Microsoft Dynamics GP appearance. Interacting with Microsoft Dynamics GP through events is discussed. Building, deploying, and debugging integrations are also addressed. Part 3, Resource Reference, provides detailed information about interacting with the various types of resources in Microsoft Dynamics GP. Part 4, Integration Examples, describes example integrations that use Visual Studio Tools for Microsoft Dynamics GP.

Whats new in this release of Visual Studio Tools


Refer to the following list for more information about the new features added for this release of Visual Studio Tools for Microsoft Dynamics GP.

1. Table access
Integrations created with Visual Studio Tools can now directly access tables in Microsoft Dynamics GP without having to use another database access technology such as ADO.NET. Refer to Chapter 9, Working with Tables, for details about accessing data in tables.

2. Updated user interface


The user interface for forms created with Visual Studio Tools has been updated to match the new appearance of Microsoft Dynamics GP windows.

3. Integrated runtime
There is no longer a separate runtime installer for Visual Studio Tools for Microsoft Dynamics GP. The runtime for Visual Studio Tools is now integrated into the core Microsoft Dynamics GP product, and is available in every installation.

4. Support for Visual Studio 2005 and Visual Studio 2008


You can use either Visual Studio 2005 or Visual Studio 2008 when creating integrations with Visual Studio Tools for Microsoft Dynamics GP.

P R O G R A M M E R S

G U I D E

IN T RO D U C T IO N

Prerequisites
You must be using Microsoft Dynamics GP 10. Since you will be working with Microsoft Dynamics GP, knowledge of the accounting system will be helpful. Consult the Microsoft Dynamics GP documentation resources to learn more about the product. You will also want to install the SDK for Microsoft Dynamics GP. The SDK is available in the Tools folder on the Microsoft Dynamics GP installation media. It contains useful information about Microsoft Dynamics GP, such as lists of commonly-used procedures and functions. To use Visual Studio Tools for Microsoft Dynamics GP, Visual Studio 2005 with Service Pack 1 or Visual Studio 2008 is required. Earlier versions of Visual Studio cannot be used. It is assumed that you are familiar with programming in a managed language such as C#. This documentation uses both C# and Visual Basic to demonstrate how to create integrations.

Symbols and conventions


To help you use this documentation more effectively, weve used the following symbols and conventions within the text to make specific types of information stand out.
Symbol Description

The light bulb symbol indicates helpful tips, shortcuts, and suggestions. Warnings indicate situations you should be aware of when completing tasks.
Margin notes summarize important information.

Margin notes call attention to critical information and direct you to other areas of the documentation where a topic is explained.
Description

Convention

Part 1, Getting Started Adding controls


using System.IO;

Bold type indicates a part name. Italicized type indicates a section name. This font is used to indicate script examples. Acronyms are spelled out the first time theyre used. Small capital letters indicate a key or a key sequence.

Chapter 5, Web Methods Quotation marks indicate a chapter name.

Dictionary Assembly Generator (DAG)


TAB

or ALT+M

Product support
Microsoft Dynamics GP developer technical support can be accessed online or by telephone. Go to www.microsoft.com/dynamics and click the CustomerSource or PartnerSource link, or call 888-477-7877 (in the US and Canada) or 701-281-0555.

PROGRAMMERS

GUIDE

P R O G R A M M E R S

G U I D E

PART 1: GETTING STARTED

Part 1: Getting Started


This portion of the documentation describes how to get started creating an integration using Visual Studio Tools for Microsoft Dynamics GP. The following topics are discussed: Chapter 1, SDK Installation, explains how to install Visual Studio Tools SDK for Microsoft Dynamics GP. Chapter 2, Integration Basics, describes the architecture of a Visual Studio Tools for Microsoft Dynamics GP integration. It also explains how to create a project for a new integration. Chapter 3, Upgrading an Integration, explains how to upgrade an existing integration to work with the current version of Visual Studio Tools for Microsoft Dynamics GP.

P R O G R A M M E R S

G U I D E

Chapter 1:

SDK Installation
The Visual Studio Tools for Microsoft Dynamics GP SDK contains the components needed to create and build integrations. The following topics are discussed: Installation procedure Template registration What was installed Upgrading to Visual Studio 2008

Installation procedure
The Visual Studio Tools for Microsoft Dynamics GP SDK installer requires Visual Studio 2005 or Visual Studio 2008 to be installed first. For testing integrations, you will also want Microsoft Dynamics GP installed. If you have installed an earlier version of the Visual Studio Tools SDK, be sure that you remove it from the system before you install the new version. To install the Visual Studio Tools for Microsoft Dynamics GP SDK, complete the following procedure: 1. Start the Visual Studio Tools SDK installer. Start the installer by running the VSToolsSDK.exe. 2. View the welcome screen. Click Next to continue. 3. Acknowledge the license agreement. Read and acknowledge the license agreement. Click Next to continue. 4. Specify the features to install. Choose the features that will be installed:
Feature
Visual Studio 2005 Templates

Description
The C# and Visual Basic templates for projects and forms. Visual Studio 2005 is required to install this feature. The C# and Visual Basic templates for projects and forms. Visual Studio 2008 is required to install this feature. The Visual Studio Tools for Microsoft Dynamics GP Programmers Guide. Sample integrations that demonstrate Visual Studio Tools. The Dictionary Assembly Generator (Dag.exe) and the dictionary assemblies for the products that ship with Microsoft Dynamics GP Also includes the . IntelliSense XML files used by Visual Studio to display information about the resources accessed through the application assemblies.

Visual Studio 2008 Templates

Documentation Samples Assemblies and Assembly Generator

5. Specify the installation location. Use the default location, or choose another location. Click next to continue.

PROGRAMMERS

GUIDE

PA RT

G E TT I N G

S T A R TE D

6. Begin the installation. Click Install to begin installing the SDK components. During the installation, Visual Studio must be reconfigured to recognize the new templates being installed. This process may take a few minutes to complete. 7. Finish the installation. Click Finish to complete the installation.

Template registration
If you are running with limited user privileges or with User Account Control (UAC) active in Windows Vista the templates installed for Visual Studio Tools may not be registered in Visual Studio. You may need to manually register the templates so they will appear as selections when you create new projects. To register the templates, perform the following command to have Visual Studio 2005 re-create its template cache: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe /setup Use the following command for Visual Studio 2008 to re-create its template cache: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe /setup On Windows Vista, you will need to set the properties of the devenv.exe application to be run with administrative privileges.

On Windows Vista, choose to run devenv.exe as an administrator.

P R O G R A M M E R S

G U I D E

C H A P T E R

S D K

I N S T A L L A T I O N

What was installed


The following items are installed for Visual Studio Tools for Microsoft Dynamics GP in the location you specified:
Component
VSTDGPReadme.rtf

Description
Contains late-breaking information about Visual Studio Tools for Microsoft Dynamics GP . Documentation for Visual Studio Tools. Sample Visual Studio projects that demonstrate Visual Studio Tools.

VSTDGPProgrammersGuide.pdf Samples.zip

Core Microsoft Dynamics GP components Microsoft.Dexterity.Bridge.dll used by Visual Studio Tools integrations. Microsoft.Dexterity.Shell.dll Microsoft.Dynamics.Framework.UI.Navigation.dll Microsoft.Dynamics.Framework.UI.WinForms. Controls.dll Dag.exe The Dictionary Assembly Generator, used to create application assemblies for application dictionaries and forms dictionaries. Support files needed for Dag.exe

Bidi32.dll Ddapi.dll Tntlib.dll Dex.dic Dex.ini Application Assemblies

Assemblies that contain information about the resources in each dictionary that is shipped with Microsoft Dynamics GP In . addition to US English, other local versions of application assemblies are included. Used by Visual Studio to display information about the corresponding application assembly.

IntelliSense XML files

If you chose to install them, the project templates for C# and Visual Basic will be in the appropriate locations for Visual Studio.

Upgrading to Visual Studio 2008


If you have previously installed the Visual Studio Tools for Microsoft Dynamics GP 10 SDK and want to upgrade from Visual Studio 2005 to Visual Studio 2008, complete the following procedure: 1. Install Visual Studio 2008. 2. Start the Visual Studio Tools SDK installer. Start the installer by running the VSToolsSDK.exe. The updated components for Visual Studio Tools will be installed. 3. Close the installer. When the installer has finished updating components, click Finish. 4. Change the Visual Studio Tools installation. In Add or Remove Programs (Windows XP or Windows Server 2003) or Programs and Features (Windows Vista or Windows Server 2008) choose Visual Studio Tools for Microsoft Dynamics GP 10.0 SDK. Click Change.

PROGRAMMERS

GUIDE

PA RT

G E TT I N G

S T A R TE D

5. Add a new feature. Click Add/Remove Features to add a new feature to the Visual Studio Tools installation. 6. Install the Visual Studio 2008 templates. Mark the option to install the Visual Studio 2008 templates, and then click Next. Click Install to begin the installation process. 7. Finish the installation. Click Finish to complete the installation.

10

P R O G R A M M E R S

G U I D E

Chapter 2:

Integration Basics
Before you create an integration using Visual Studio Tools for Microsoft Dynamics GP, it will be helpful to understand the basics of an integration. The following topics are discussed: What Visual Studio Tools provides Architecture Creating a project

What Visual Studio Tools provides


Visual Studio Tools for Microsoft Dynamics GP provides three main capabilities for an integrating application:

Customized WinForms
Any WinForms included in an integrating application can use capabilities provided by Visual Studio Tools for Microsoft Dynamics GP to match the appearance of the core application. The appearance of the window as well as the various controls in the window can be customized. You will learn about creating windows for your integration in Chapter 4, WinForms, and Chapter 5, Control Reference.

Access to dictionary resources


Integrating applications have access to the numerous resources available in the application dictionaries used for Microsoft Dynamics GP. An integrating application can access the forms, windows, window fields, tables, and table fields in each dictionary. They can also access global variables, commands, procedures, and functions defined in each dictionary. You will learn about accessing dictionary resources in Chapter 7, Accessing Dictionary Resources.

Access to events
Integrating applications can be notified of events that occur in Microsoft Dynamics GP, such as a window being opened, or the focus moving to a field. The applications can respond to the events, performing actions like verifying field values or opening additional windows. Chapter 8, Events, contains information about registering for and responding to events.

Architecture
Visual Studio Tools for Microsoft Dynamics GP consists of runtime components and development components.

Runtime components
The runtime components for Visual Studio Tools are installed with Microsoft Dynamics GP, and provide the functionality used by the integrations. These consist of the following: Dexterity Shell This assembly (Microsoft.Dexterity.Shell.dll) provides the drawing capabilities that allow an integrating application to match the appearance of Microsoft Dynamics GP. Dexterity Bridge This assembly (Microsoft.Dexterity.Bridge.dll) provides the access to events in Microsoft Dynamics GP, as well as the resources in the application dictionaries.

PROGRAMMERS

GUIDE

11

PA RT

G E TT I N G

S T A R TE D

Application assemblies Each dictionary that will be accessed by a Visual Studio Tools for Microsoft Dynamics GP integration will have an application assembly. Each application assembly provides access to the resources in its corresponding dictionary. For example, the Application.Dynamics.dll assembly provides access to the resources in the Dynamics.dic dictionary. Visual Studio Tools for Microsoft Dynamics GP includes the application assemblies for all the modules that ship with Microsoft Dynamics GP. You can use the Dictionary Assembly Generator tool (Dag.exe) to create application assemblies for other third-party dictionaries for Microsoft Dynamics GP. You will learn more about this tool in Chapter 6, Dictionary Assembly Generator. AddIns folder The assemblies for the integrating applications created with Visual Studio Tools for Microsoft Dynamics GP are placed in this folder. When Microsoft Dynamics GP is launched, it automatically looks in this folder and attempts to launch the integrating applications it finds there.

Development components
The following development components are installed in the folder where you chose to install Visual Studio Tools for Microsoft Dynamics GP: DAG.exe This is the Dictionary Assembly Generator tool, used to create application assemblies for dictionaries. You will use this to create application assemblies for third-party dictionaries that do not have them. You will also use it to create application assemblies for forms dictionaries in cases where your integration must interact with modified forms in Microsoft Dynamics GP. IntelliSense XML files The IntelliSense XML file contains the information about the application assembly that is displayed in the IntelliSense within Visual Studio. The name of the application XML file matches that of the application assembly it corresponds to. For example, the Application.Dynamics.xml file contains information about the Application.Dynamics.dll assembly. The following components are installed into the Visual Studio installation: Visual Basic project This is the template project for an add-in that is based in Visual Basic. Visual C# project This is the template project for an add-in that is based in Visual C#.

Creating a project
Use the following procedure to create a new Visual Studio project for a Microsoft Dynamics GP add-in. 1. Start Visual Studio. If it isnt already running, start Visual Studio. 2. Create a new project. In the File menu, point to New and choose Project. 3. Select the project type. Choose either a Visual Basic project or a Visual C# project. Under the type you have selected, choose Dynamics GP.

12

P R O G R A M M E R S

G U I D E

C H A P T E R

I N T E G R A T I O N

B AS I C S

4. Choose the Microsoft Dynamics GP Add-in template. In the list of available templates, choose the Microsoft Dynamics GP Add-in project template.

If the Microsoft Dynamics GP templates are not listed, you may need to register them manually. Refer to Template registration on page 8 for details about doing this. 5. Specify the name and location of the project. Click OK to create the project.

PROGRAMMERS

GUIDE

13

14

P R O G R A M M E R S

G U I D E

Chapter 3:

Upgrading an Integration
If you have created an integration with Visual Studio Tools for Microsoft Dynamics GP 9, use the following procedures to upgrade your integration to work with the current version of Visual Studio Tools. Be sure you have installed the current version of Visual Studio Tools before attempting to upgrade your integrations. The following upgrade procedures are described: C# integration Visual Basic integration

C# integration
Use the following procedure to upgrade a Visual Studio Tools integration created with C#. 1. Open the solution for your integration. Using Visual Studio, open the solution file for the integration you want to upgrade. 2. Rebuild application assemblies. If you had built any application assemblies for your integration, you will need to re-build them so they are up-to-date with the latest version of Microsoft Dynamics GP. 3. Update the assembly references. The assembly references for the project will be incorrect, because they wont refer to the new versions of the Visual Studio Tools components and application assemblies.

The assembly references are incorrect and need to be updated.

Add references to the updated Visual Studio Tools assemblies, to replace the broken references. The reference to the Microsoft.Dexterity.Shell.UI assembly is a special situation. This component was merged into the Microsoft.Dexterity.Shell assembly. Create a reference to the Microsoft.Dexterity.Shell assembly, and delete the reference to the Microsoft.Dexterity.Shell.UI assembly.

PROGRAMMERS

GUIDE

15

PA RT

G E TT I N G

S T A R TE D

4. Update the namespaces used in integration code. The namespace for the shell (user interface) components of the Visual Studio Tools integration has changed. The namespace reference must be changed from:
Microsoft.Dexterity.Shell.UI

To the updated value:


Microsoft.Dexterity.Shell

5. Update the namespace references used for any forms. The same namespace change must be made for any forms you created for your integration. When you attempt to open a form in the Visual Studio designer, you will see an error similar to the following:

This means that the code used for the form is using the old namespace, rather than the new Microsoft.Dexterity.Shell namespace. You must view the code for the form, and change all of the namespace references to remove the UI portion. This will be required in several places. An example of code to be fixed is shown highlighted in the following illustration.

You may need to expand some hidden sections of the code to find all of the references. After making these changes to the forms code, save the updated file. Close the form designer if it is still open, and then re-open the form. The form should now open and have the updated Microsoft Dynamics GP appearance. 6. Build the solution. Choose to build the updated solution in Visual Studio. You may encounter build errors if your integration references resources in Microsoft Dynamics GP that have been deleted, moved, or renamed. You will need to fix these issues and rebuild the integration.

16

P R O G R A M M E R S

G U I D E

C H A P T E R

U P G R A D I N G

A N

I N TE G R A T I O N

Visual Basic integration


Use the following procedure to upgrade a Visual Studio Tools integration created with Visual Basic. 1. Open the solution for your integration. Using Visual Studio, open the solution file for the integration you want to upgrade. 2. Rebuild application assemblies. If you had built any application assemblies for your integration, you will need to re-build them so they are up-to-date with the latest version of Microsoft Dynamics GP. 3. Update the assembly references. The assembly references for the project will be incorrect, because they wont refer to the new versions of the Visual Studio Tools components and application assemblies.

The assembly references are incorrect and need to be updated.

Add references to the updated Visual Studio Tools assemblies, to replace the broken references. The reference to the Microsoft.Dexterity.Shell.UI assembly is a special situation. This component was merged into the Microsoft.Dexterity.Shell assembly. Create a reference to the Microsoft.Dexterity.Shell assembly, and delete the reference to the Microsoft.Dexterity.Shell.UI assembly. 4. Update the namespaces used in integration code. The namespace for the shell (user interface) components of the Visual Studio Tools integration has changed. Any namespace reference must be changed from:
Microsoft.Dexterity.Shell.UI

To the updated value:


Microsoft.Dexterity.Shell

PROGRAMMERS

GUIDE

17

PA RT

G E TT I N G

S T A R TE D

5. Update the namespace references used for any forms. The same namespace change must be made for any forms you created for your integration. When you attempt to open a form in the Visual Studio designer, the code for the form will be displayed:

Fix the namespace references for the form.

6. Update the form designer code. Open the Designer source file for the form to fix the references so they use the new Microsoft.Dexterity.Shell namespace. Change all of the namespace references to remove the UI portion. This will be required in several places. An example of code to be fixed is shown in the following illustration.

Fix all of the references to use the new Microsoft.Dexterity.Shell namespace.

After making these changes to the forms code, save the updated file. Re-open the form. The form should appear in the form designer and have the updated Microsoft Dynamics GP appearance. 7. Build the solution. Choose to build the updated solution in Visual Studio. You may encounter build errors if your integration references resources in Microsoft Dynamics GP that have been deleted, moved, or renamed. You will need to fix these issues and rebuild the integration.

18

P R O G R A M M E R S

G U I D E

PART 2: DEVELOPING INTEGRATIONS

Part 2: Developing Integrations


This portion of the documentation describes the various techniques you will use as you develop integrations using Visual Studio Tools for Microsoft Dynamics GP. The following topics are discussed: Chapter 4, WinForms, describes how to create WinForms that have the appearance of windows in Microsoft Dynamics GP. Chapter 5, Control Reference, provides details of the various controls that are modified by Visual Studio Tools for Microsoft Dynamics GP. Chapter 6, Dictionary Assembly Generator, describes the tool used to create .NET assemblies that provide access to dictionary resources. Chapter 7, Accessing Dictionary Resources, explains how to access resources in dictionaries from your integrating application. Chapter 8, Events, describes how to register for and respond to events for Microsoft Dynamics GP. Chapter 9, Working with Tables, describes how to directly access Microsoft Dynamics GP tables from an integration. Chapter 10, Building and Deploying, explains how to build and deploy an integration you have created. Chapter 11, Debugging, explains how to debug an integration created with Visual Studio Tools for Microsoft Dynamics GP. Chapter 12, Modified and Alternate Forms, describes how to access resources on modified forms and alternate forms in Microsoft Dynamics GP.

20

P R O G R A M M E R S

G U I D E

Chapter 4:

WinForms
Standard WinForms are the basis for the user interface for add-ins created with Visual Studio Tools for Microsoft Dynamics GP. These WinForms and the controls placed on them are specially modified to match the appearance of Microsoft Dynamics GP. Information about WinForms is divided into the following sections: Adding a Dynamics GP form to a project WinForm properties Adding controls

Adding a Dynamics GP form to a project


To add a new Dynamics GP form to an add-in project, complete the following procedure: 1. Add a new component. In Visual Studio, choose Add Component from the Project menu. 2. Select a Microsoft Dynamics GP Form. In the list of templates, choose a Microsoft Dynamics GP form.

Choose a Microsoft Dynamics GP Form.

3. Name the new form. Give the form a name that is appropriate for how it will be used. 4. Add the new form. Click Add to add the new WinForm to the project. 5. Specify the form properties. Set the necessary properties for the new form.

PROGRAMMERS

GUIDE

21

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

WinForm properties
WinForms that are added to a Visual Studio Tools for Microsoft Dynamics GP project have several additional properties that control their appearance. Setting these properties correctly helps match the appearance of Microsoft Dynamics GP. These properties are: AutoSetDexColors ControlArea StatusArea

These WinForm properties are found in the Dexterity group in the Properties pane in Visual Studio.

AutoSetDexColors
The AutoSetDexColors property controls whether the colors used for the WinForm will automatically match the color scheme selected in the user preferences within Microsoft Dynamics GP. Set this property to True to match the Microsoft Dynamics GP appearance.

ControlArea
The ControlArea property specifies whether the band called the control area is drawn at the top of the WinForm. In standard Microsoft Dynamics GP windows, controls such as Save, Clear, and Delete buttons are placed in the control area. Set this property to True to display the control area for a WinForm.

This is the control area.

StatusArea
The StatusArea property specifies whether the band called the status area is drawn at the bottom of the WinForm. A divider line is drawn across the bottom of the WinForm to indicate the status area. In standard Microsoft Dynamics GP windows, controls like browse buttons, note buttons, and help buttons are placed in the status area. Set this property to True to display the status area for a WinForm.

This is the status area.

22

P R O G R A M M E R S

G U I D E

C H A P T E R

W I N F O R M S

Adding controls
You can add controls to the forms for your Microsoft Dynamics GP integration the same way you add them to standard windows forms. Simply select the control in the Toolbox and drag it out onto the form.

To add a control, just select it in the Toolbox and drag it onto the form.

When you add the controls, additional properties will be available for some of them to match the Microsoft Dynamics GP appearance. For example, push buttons will have additional properties. Refer to Chapter 5, Control Reference, for more information about individual controls.

PROGRAMMERS

GUIDE

23

24

P R O G R A M M E R S

G U I D E

Chapter 5:

Control Reference
You can use any of the available controls on the WinForms for your Microsoft Dynamics GP integration. Some of the standard controls have been customized to better match the appearance of Microsoft Dynamics GP. This portion of the documentation describes the controls that have additional properties or updated characteristics when used on a WinForm in a Visual Studio Tools for Microsoft Dynamics GP project. The following controls are discussed: Buttons TextBoxes Labels ComboBoxes ListBoxes

Buttons
Button controls are used for each of the button types in a Microsoft Dynamics GP form. The button controls on a WinForm for a Microsoft Dynamics GP project get their additional characteristics from the dexButtonProvider you see on the WinForm layout. The ButtonType property is an additional property available for each button. It specifies how the button control is displayed and what characteristics it will have. You can set the AutoSetDexColors property to True so the button colors will match colors in Microsoft Dynamics GP. The following is a list of the settings for the ButtonType property, and a description of how each button type is used.

Standard
Standard buttons dont have their appearance modified changed when placed on a WinForm for a Dynamics GP project. The following illustration shows a standard button.

This is a standard button

Toolbar
Buttons with the ButtonType set to Toolbar are typically placed in the control area of a Microsoft Dynamics GP form. These buttons have a flat appearance, with a special color highlighting when the pointer is placed over them. It is also common for these buttons to have pictures on them. The following illustration shows a toolbar button.
A toolbar button is typically placed in the control area.

PROGRAMMERS

GUIDE

25

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

ToolbarWithSeparator
The buttons with the type ToolbarWithSeparator buttons are typically placed in the control area, like buttons with the type Toolbar. However, they have an additional separator line drawn on the right side of the button to separate it from the other controls in the control area. The following illustration shows two buttons that have the type ToolbarWithSeparator. Notice the separator line drawn to the right of each button.
These are toolbar buttons with separators.

StatusArea
Buttons placed in the status area at the bottom of a window should have the type StatusArea. These buttons should display only graphics, and will have a special 3-D border drawn around them when the pointer is placed over them. These buttons should have the Tooltip property set so they will display a description of the action the button performs. A status area button is shown in the following illustration. It displays a tooltip that describes the purpose of the button.

Buttons in the status area typically have only pictures.

Field
Buttons that show only pictures, and are placed next to other controls in the form should have the ButtonType property set to Field. These buttons are used for things like lookups or expansions. Several buttons with this type are shown next to a text control in the following illustration.
These are field buttons.

Pictures for buttons


Each Visual Studio for Microsoft Dynamics GP project includes several standard images that are used for buttons in Microsoft Dynamics GP. These images (in PNG format) should be used with the buttons you create for your integrations. The following table lists the images and describes how they are used.
Image Name
Field_Delete.png Field_Edit.png Field_Expansion.png Field_Lookup.png Field_MapPoint.png

Description
Used for delete buttons in the window area placed next to fields. Used for edit buttons in the window area placed next to fields. Used for expansion buttons in the window area placed next to fields. Used for lookup buttons in the window area placed next to fields. Used for MapPoint buttons in the window area placed next to fields.

26

P R O G R A M M E R S

G U I D E

C H A P T E R

C O N T R O L

R E F E R E N C E

Image

Name
Field_NoteAbsent.png Field_NotePresent.png HelpImage.png Toolbar_Cancel.png Toolbar_Clear.png Toolbar_Copy.png Toolbar_Delete.png Toolbar_DeleteAll.png Toolbar_New.png Toolbar_Open.png Toolbar_Post.png Toolbar_Print.png Toolbar_Redisplay.png Toolbar_Save.png Toolbar_Void.png VCR_First.png VCR_Last.png VCR_Next.png VCR_Previous.png Window_NoteAbsent.png Window_NotePresent.png

Description
Used for note buttons in the window area placed next to fields. Used for note buttons in the window area placed next to fields. Used for the Help button placed in the status area of the window. Used for the Cancel button placed in the window control area. Used for the Clear button placed in the window control area. Used for the Copy button placed in the window control area. Used for the Delete button placed in the window control area. Used for the Delete All button placed in the window control area. Used for the New button placed in the window control area. Used for the Open button placed in the window control area. Used for the Post button placed in the window control area. Used for the Print button placed in the window control area. Used for the Redisplay button placed in the window control area. Used for the Save button placed in the window control area. Used for the Void button placed in the window control area. Used for the First browse control in the window status area. Used for the Last browse control in the window status area. Used for the Next browse control in the window status area. Used for the Previous browse control in the window status area. Used for the note button in the window status area. Used for the note button in the window status area.

TextBoxes
TextBox controls are used for the string, integer, currency, date, and time controls in a Microsoft Dynamics GP form. Text boxes have the AutoSetDexColors property that can be set to True so the control colors will match colors in Microsoft Dynamics GP.
A TextBox control is used for standard fields like currency values.

PROGRAMMERS

GUIDE

27

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Unlike the standard controls in Microsoft Dynamics GP, the textbox controls have no built-in support to format data such as currency values. You will need to add additional code to your integration to match the behavior of the controls in Microsoft Dynamics GP. For instance, the following C# code sets the value of the textbox in the previous illustration. It uses the Format method for the String object to format the currency value.
// Display the value, formatting it as a currency amount textBoxEstimatedFreight.Text = String.Format("{0:C}",EstimatedFreight);

Labels
Label controls are used for the text labels that appear next to controls in the Microsoft Dynamics GP form. They correspond to the static text items that appear in standard Microsoft Dynamics GP windows.
A label control displays the text label that appears next to another control.

Label controls have the LinkField property that should be set when a specific field is being labeled. This property is set to the name of the control that the label applies to. When specified in the Microsoft Dynamics GP User Preferences, the label will be drawn with the single underline that is standard for prompts. To have the underlined label draw correctly, be sure the AutoSize property for the label is set to False.

ComboBoxes
Use the ComboBox control in cases where you would use a drop-down list or combo box in Microsoft Dynamics GP. ComboBox controls have the AutoSetDexColors property that can be set to True so the control colors will match colors in Microsoft Dynamics GP. The following illustration shows a ComboBox control being used as a drop-down list in a Microsoft Dynamics GP form.

ListBoxes
Use the ListBox control in cases where you would used a list box or multi-select list box in Microsoft Dynamics GP.

28

P R O G R A M M E R S

G U I D E

Chapter 6:

Dictionary Assembly Generator


The Dictionary Assembly Generator (DAG.exe) is a utility included with Visual Studio Tools for Microsoft Dynamics GP that creates a managed code assembly that provides access to resources in an application dictionary. Information about this tool is divided into the following sections: Creating application assemblies Output files Using the Dictionary Assembly Generator Optimizing the assembly generating process

Creating application assemblies


Several application assemblies are included with the Visual Studio Tools for Microsoft Dynamics GP. These are the assemblies for the core application (Dynamics.dic) and the other applications that are delivered with Microsoft Dynamics GP. When developing integrations that use resources from these dictionaries, always use the application assemblies that are included with the Visual Studio Tools installation. These assemblies are digitally signed, indicating they were produced by Microsoft. Dont generate your own versions of application assemblies for dictionaries shipped with the Microsoft Dynamics GP product. You will create application assemblies for the following cases: A forms dictionary exists for a product, and you want your Microsoft Dynamics GP integration to access the modified resources in the forms dictionary. You have installed a third-party dictionary for which no application assembly exists, and you want to access resources in this dictionary from your Microsoft Dynamics GP integration. The third-party dictionary could contain new forms and other resources. It could contain alternate forms from the Dynamics.dic dictionary.

Output files
The Dictionary Assembly Generator produces two output files that are used in your integration: an application assembly and IntelliSense data file.

Application assembly
The most important output is the application assembly. This is the managed code assembly that provides access to the resources in a dictionary. Each dictionary can have one corresponding application assembly. The following naming convention is used for application dictionaries: Application.ProductName.dll The following naming convention is used for forms dictionaries: Application.ProductName.ModifiedForms.dll

PROGRAMMERS

GUIDE

29

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

ProductName is automatically derived from product name in the launch file. Any spaces or special characters in the product name are removed. For example, the application assembly that provides access to resources in the SRVCADV.dic application dictionary is named Application.FieldService.dll. The application assembly that provides access to the resources in the forms dictionary (FRMS949..dic) is named Application.FieldService.ModifiedForms.dll.

IntelliSense data file


The second type of output from the Dictionary Assembly Generator is the IntelliSense data file that will be used by Visual Studio. This file has the same name as its corresponding application assembly, but has the .xml extension. As you write code, Visual Studio will use the information from this file to display details about the resources that can be accessed through the application assembly. An example of the IntelliSense for a dictionary resource is shown in the following illustration.

Information from the application assembly XML file is displayed in IntelliSense.

Using the Dictionary Assembly Generator


The Dictionary Assembly Generator (DAG.exe) is installed in the location where you installed Visual Studio Tools. Typically this will be the following location: C:\Program Files\Microsoft Dynamics\GP10 VS Tools SDK The Dictionary Assembly Generator is a command-line tool, and should be run from a command prompt. Open a command prompt and set the current location to the folder where DAG.exe is located.

To view the command syntax, use the following command at the command prompt:
dag.exe /?

The Dictionary Assembly Generator uses the product ID to identify the dictionary for which you want to build the application assembly. Look in the launch file (typically Dynamics.set) for a list of the products installed.

30

P R O G R A M M E R S

G U I D E

C H A P T E R

D I C T I O N A R Y

A S S EM B L Y

G E N ER AT O R

Optionally, you can specify the launch file that the Dictionary Assembly Generator will look in to find the list of installed products and the corresponding dictionary locations. If you dont supply the name of the launch file, DAG.exe will look for the launch file named Dynamics.set in the current location. Since you are running DAG.exe from a different location than where Microsoft Dynamics GP is installed, you will need to supply the complete path to the launch file. The Dictionary Assembly Generator must be able to write to the location where it is being run from. Typically, this means the user running DAG.exe must be part of the Administrators group or the Power Users group on Windows XP. On Windows Vista, it means launching DAG.exe with Administrative privileges.

Building an application assembly


The Dictionary Assembly Generator will build an application assembly for the main dictionary for an application or for the forms dictionary for an application. When generating an assembly for an application dictionary, use the /M parameter. For example, the following command generates the application assembly for the main dictionary of the Sample Integrating Application. This application has the product ID value 3333. The path to the launch file (Dynamics.set) is supplied.
dag.exe 3333 "C:\Program Files\Microsoft Dynamics\GP\Dynamics.set" /M

This command produces two files: Application.SampleIntegratingApp.dll Application.SampleIntegratingApp.xml

To generate an assembly for a forms dictionary, use the /F parameter. For example, the following command generates the application assembly for the forms dictionary of the Field Service product (with dictionary ID 949).
dag.exe 949 "C:\Program Files\Microsoft Dynamics\GP\Dynamics.set" /F

This command produces two files: Application.FieldService.ModifiedForms.dll Application.FieldService.ModifiedForms.xml

Refer to Modified forms on page 65 for details about creating an application assembly for the forms dictionary (Forms.dic) used by Microsoft Dynamics GP.

Signing an application assembly


You may want to sign the application assemblies you create. This is a good practice, because it helps ensure that only the official version of an application assembly is being used. The Dictionary Assembly Generator can sign the assemblies that it creates. It can fully sign the assemblies, or delay sign them. You can use the SN.exe utility (included with the .NET Framework) to create a strong name key file (.snk) used to sign the assembly. Once you create and use a strong name key file, keep it in a safe location. You will need to use it every time you build or rebuild application assemblies. The following example shows how the application assembly for the sample integrating application is fully signed using the Sample.snk strong name key. The Sample.snk file was generated using the SN.exe utility.
dag.exe 3333 "C:\Program Files\Microsoft Dynamics\GP\Dynamics.set" /M /S:Sample.snk

PROGRAMMERS

GUIDE

31

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Overriding the application assembly name


When creating an application assembly for a dictionary, the Dictionary Assembly Generator will use the product name from the launch file. This may not be the name you want to use for the application assembly. You can use the /N parameter to specify a different name for the application assembly being generated. For example, the following command will create an application assembly for the sample integrating application, but use the name Develop instead of the product name in the launch file.
dag.exe 3333 "C:\Program Files\Microsoft Dynamics\GP\Dynamics.set" /M /N:Develop

The generated application assembly will have the name Application.Develop.dll.

Overriding the main referenced dictionary name


When generating application assemblies for dictionaries that integrate with Microsoft Dynamics GP, the Dictionary Assembly Generator must be able to reference the application assembly for the main dictionary (typically Application.Dynamics.dll). If the application assembly for the main dictionary has been given a different name, you can use the /NM parameter to specify which new name so the application assembly can be found. For example, if the application assembly for the main dictionary was named Application.DynamicsGP.dll, you would use the following command to create an application assembly for the sample integrating application. Notice that the /NM parameter is used to specify the name of the main application assembly that is being referenced.
dag.exe 3333 "C:\Program Files\Microsoft Dynamics\GP\Dynamics.set" /M /NM:DynamicsGP

Optimizing the assembly generating process


Producing an application assembly for large dictionaries is a resource-intensive process. The Dictionary Assembly Generator will use a large amount of memory (often over 1 gigabyte) and substantial processor time when producing an application assembly. To optimize the process, do the following: Use the best hardware you have available to generate the application assembly. Close all other applications before starting the process. Temporarily turn off background processing tasks, such as virus scanning.

32

P R O G R A M M E R S

G U I D E

Chapter 7:

Accessing Dictionary Resources


To create an integration for Microsoft Dynamics GP or the additional applications that are installed with it, your code must access resources in the various application dictionaries. This portion of the documentation describes how to do this for your project. The following topics are discussed: Adding references Namespace Dictionary class Accessing additional resources Variables for dictionary resources

Adding references
To access the resources in a specific dictionary, a project must contain a reference to the application assembly for that dictionary. When you create a new Visual Studio Tools for Microsoft Dynamics GP project, it will automatically contain a reference to the Application.Dynamics.dll application assembly. This provides access to resources in the Dynamics.dic dictionary. To access resources in other dictionaries, add references to the application assemblies for them. If a dictionary doesnt have a corresponding application assembly, refer to Chapter 6, Dictionary Assembly Generator, to learn how to create one. For example, to access resources from the Sample Integrating App application installed with Microsoft Dynamics GP, the project should contain a reference to the Application.SampleIntegratingApp.dll application assembly. The following illustration shows this reference for a C# project.

This reference provides access to the resources in the corresponding dictionary.

PROGRAMMERS

GUIDE

33

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Namespace
Resources for a dictionary are accessed through the following namespace: Microsoft.Dexterity.Applications To make it convenient to access resources, this namespace is included in the C# project template with the using statement. In the Visual Basic project template, its included using the Imports statement. Referencing the namespace prevents you from having to fully-qualify references to dictionary resources.

Dictionary class
The resources in a dictionary are accessed through a single class that is available after you add the reference to the dictionarys application assembly. The class has the same name that appears in the application assembly. For instance, the class to access resources for the Dynamics dictionary is named Dynamics. Similarly, the class used to access resources for the Sample Integrating Application is named SampleIntegratingApp. This is the same name that appears in the application assembly, Application.SampleIntegratingApp.dll. The five primary resource types in a dictionary are accessed through properties of the class. These resource types are: Forms Globals Procedures Functions Tables

To access a resource of the specific type, start by typing the dictionary class name, and then property for the resource type. IntelliSense in Visual Studio will present a list of the specific type of resources available in the dictionary. For example, the following illustration shows the forms resources in the Dynamics core application.
Type the dictionary class name and the resource type property. IntelliSense displays a list of resources.

When youve selected a resource of the specific type, you will see a list of the properties, methods, and events available for that resource. The following illustration shows some of the properties, methods, and events for the AboutBox form in the Dynamics dictionary.

34

P R O G R A M M E R S

G U I D E

C H A P T E R

A C C E S S I N G

D I C T I O N A R Y

R ES O U R C E S

Accessing additional resources


Several additional resource types are accessed through the Forms property of a dictionary class. These include: Windows Commands Form-level procedures Form-level functions Form-level table buffers

As an example, the following C# statement opens the Customer Maintenance window. Notice how the window is accessed through the form object.
Dynamics.Forms.RmCustomerMaintenance.RmCustomerMaintenance.Open();

Windows provide further access to two additional resource types: Fields Scrolling windows

For instance, the following C# statement sets the value of the Comment 1 field in the Vendor Maintenance window.
Dynamics.Forms.PmVendorMaintenance.PmVendorMaintenance.Comment1.Value = "A preferred vendor";

You will learn more about the details about using each resource type in Part 3, Resource Reference.

Variables for dictionary resources


Within your code, it may be useful to create variables for specific resources in an application dictionary. The definitions for the various dictionary resources are found in an additional namespace available in the application assembly. This namespace has the same name that appears in the application assembly, but has Dictionary appended. For instance, to reference the definitions for resources in the Dynamics main dictionary, you would use this namespace: Microsoft.Dexterity.Applications.DynamicsDictionary To reference resources for the Sample Integrating Application, you would use this namespace: Microsoft.Dexterity.Applications.SampleIntegratingAppDictionary; After creating the variable, you can assign its value and then use it in your code. For example, the following C# code creates a variable for the Vendor Maintenance form in Microsoft Dynamics GP. It assigns the form to the variable, and then uses it to open the form.
PmVendorMaintenanceForm VendorMaintenanceForm; VendorMaintenanceForm = Dynamics.Forms.PmVendorMaintenance; VendorMaintenanceForm.Open();

PROGRAMMERS

GUIDE

35

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Using a variable can simplify your code, especially when accessing dictionary resources that have long names. For example, the following C# code creates a variable for the Customer Maintenance window in Microsoft Dynamics GP. Then it sets the values of two fields in the window. Notice it take less code to set the field when the variable for the window is used.
// Create the variable and set its value RmCustomerMaintenanceForm.RmCustomerMaintenanceWindow CustMaintWindow; CustMaintWindow = Dynamics.Forms.RmCustomerMaintenance.RmCustomerMaintenance; // Accessing window fields requires less code when using the variable CustMaintWindow.Comment1.Value = "Comment 1"; Dynamics.Forms.RmCustomerMaintenance.RmCustomerMaintenance.Comment2.Value = "Comment 2";

36

P R O G R A M M E R S

G U I D E

Chapter 8:

Events
Applications that integrate with Microsoft Dynamics GP often need to be notified when specific events occur in the system. This portion of the documentation describes how to register to be notified when events occur in the system. It also describes how to write event handlers that can respond to the events. Information is divided into the following sections: Registering events Responding to events

Registering events
Your integrating application must register every event that it should be notified of in the system. Event registrations are added to the Initialize() method, located in the template code that is automatically added when you created your Visual Studio Tools for Microsoft Dynamics GP project. The resources for which you can register events, such as forms, windows, or fields, each list the events they make available. For example, a form has the following events available: OpenBeforeOriginal OpenAfterOriginal CloseBeforeOriginal CloseAfterOriginal

Refer to each resource type described in Part 3, Resource Reference, for the list of events that are available for that resource. To register an event, find the resource for which you want to register the event. Pick the event you want, and then specify the event handler method. The event handler is the method that contains the code that runs in response to the event.

C#
Visual Studio will assist you when you register an event in C# code. Begin by referencing the resource for which you want to register an event. Add the += operator, and Visual Studio will display IntelliSense indicating it will complete the event handler. Simply press the TAB key to add the event handler registration.

PROGRAMMERS

GUIDE

37

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

After the event handler registration is added, Visual Studio will offer to add the event handler method for the new event. Press the TAB key again to add the event handler method. When youre finished, the completed event will look similar to the following:
public void Initialize() { Dynamics.Forms.RmCustomerMaintenance.OpenAfterOriginal += new EventHandler(RmCustomerMaintenance_OpenAfterOriginal); } void RmCustomerMaintenance_OpenAfterOriginal(object sender, EventArgs e) { throw new Exception("The method or operation is not implemented."); }

Visual Basic
Registering an event in a Visual Basic project requires two steps. First, in the Initialize() method of the project, the AddHandler statement registers the event. The AddHandler statement takes two parameters. The first specifies the resource and event, while the second specifies the event handler method that will be run. The following example registers the AfterOpen event for the Customer Maintenance form in Microsoft Dynamics GP.
Sub Initialize() Implements IDexterityAddIn.Initialize AddHandler Dynamics.Forms.RmCustomerMaintenance.OpenAfterOriginal, _ AddressOf RMCustMaintAfterOpen End Sub

In the second step, the event handler method is added. The parameters for this method must match those required by the event. The IntelliSense for the event displays the parameters the event handler must have.

The parameters required for the event handler method are displayed.

The following example shows the event handler method added for the event created in the previous example.
Public Sub RMCustMaintAfterOpen(ByVal sender As Object, ByVal e _ As System.EventArgs) MsgBox("Not Implemented") End Sub

38

P R O G R A M M E R S

G U I D E

C H A P T E R

E V E N T S

Responding to events
The event handler method contains the code that runs in response to the event. This code can perform whatever action is required for your integrating application. For example, the following C# code is the event handler that runs in response to the value of the Sales Document Number field being changed in the Sales Transaction Entry window. If the EstimateFreight form is open, the controls on the form are set.
void SopNumber_Change(object sender, EventArgs e) { // If the Estimate Freight form is open, update the document number // and clear the other controls so the new calculation can be performed. if (EstimateFreightForm.Created == true) { EstimateFreightForm.textBoxDocumentNumber.Text = SOPEntryWindow.SopNumber.Value; EstimateFreightForm.textBoxEstimatedFreight.Clear(); EstimateFreightForm.textBoxTotalWeight.Clear(); } }

Some events can be cancelled through the event handler. Typically, these are events that occur before the event in the core application, such as the OpenBeforeOriginal event for a form. The event argument parameter that is passed to the event handler for these events has a special type that allows the event to be cancelled. For example, the following Visual Basic example is the event handler for the BeforeOpen event of the Customer Maintenance form. The event handler method examines the current user logged into the system. If its the sa user, a message is displayed and the window isnt opened. Notice how the event arguments are used to cancel the event.
Public Sub RMCustMaintBeforeOpen(ByVal sender As Object, ByVal e _ As System.ComponentModel.CancelEventArgs) If Dynamics.Globals.UserId.Value = "sa" Then 'Display the message MsgBox("Do not access this window as the Administrator") 'Prevent the form from opening Dynamics.Forms.RmCustomerMaintenance.Close() 'Cancel pending events e.Cancel = True End If End Sub

PROGRAMMERS

GUIDE

39

40

P R O G R A M M E R S

G U I D E

Chapter 9:

Working with Tables


A Visual Studio Tools integration can interact directly with tables defined in Microsoft Dynamics GP. Using the table integration capability is much simpler than creating and managing external connections to the Microsoft Dynamics GP database. Information about working with tables is divided into the following sections: Tables in Microsoft Dynamics GP Table buffers Opening and closing tables Keys Retrieving a row Saving a row Updating a row Removing a row Table operation errors Ranges Row locking Multiuser processing

Tables in Microsoft Dynamics GP


To learn about tables in Microsoft Dynamics GP, you will need to access information from the following sources.

Resource Descriptions tool


The Resource Descriptions tool available in Microsoft Dynamics GP provides essential details about each table in the application. Information such as the fields in the table and the keys defined for the table can be found here.

Important details, such as the keys defined for the table, can be found in the Table Descriptions window.

PROGRAMMERS

GUIDE

41

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Microsoft Dynamics GP SDK


The Microsoft Dynamics GP SDK contains detailed diagrams and descriptions of the tables in Microsoft Dynamics GP. You can use these diagrams to learn about the table in a specific module, and how the tables work together. Information about how transactions flow through the various tables is also available in the Microsoft Dynamics GP SDK.

IntelliSense
The IntelliSense available in Visual Studio will be helpful by listing what tables are available, as well as which fields are available in those tables.

IntelliSense lists which tables are available. A description of each table is also provided.

Table buffers
A table buffer provides access to one row of a specific table. The information in the table buffer comes from either the table or a script that has run. Your code will interact with the table buffer when you perform operations on the table. There are two types of table buffers: global and form-level. A global table buffer is created when a table is accessed directly through the global list of tables. Global table buffers are accessed through the dictionary class. This class has a Tables property that provides access to the collection of tables defined in the dictionary. A global table buffer is not shared with any other code. This makes global table buffers useful in situations where a Visual Studio Tools integration must read from or write to a Dynamics GP table, but isnt interacting with the user interface.

Dynamics GP Table

Global Table Buffer

Visual Studio Tools Application Code

A form-level table buffer is created when a table is attached to a form in Microsoft Dynamics GP. There is one table buffer for each table that is attached to the form. Each form-level table buffer is shared by the code that is part of the form, as well as any code outside of the form that accesses the table through that form. The Tables property for the form allows access to the table buffers for the tables that are attached to the form. Because they are shared, form-level table buffers arent typically used by Visual Studio Tools integrations to directly read from or write to tables. Instead, the form-level table buffers are examined to find what data the Dynamics GP window has read or is writing to the specific table.

42

P R O G R A M M E R S

G U I D E

C H A P T E R

WO R K IN G

WIT H

T A B LE S

Form Dynamics GP Window

Visual Studio Tools Application Code

Form-level Table Buffers

Dynamics GP Tables

Opening and closing tables


There is no explicit open operation for a table in Visual Studio Tools. The first time a table buffer is accessed, the table is automatically opened. The table buffer remains open until it is closed. When your integrating applications code has finished working with a global table buffer, it must be closed using the Close() method for the table. Failing to close a global table buffer will cause a Background process is running: Exit Aborted error when the user attempts to exit Microsoft Dynamics GP.

The user will see this error when global table buffers are left open in a Visual Studio Tools integration.

For form-level table buffers, the table buffer will be closed when the form is closed. Explicitly closing a form-level table buffer with the Close() method is needed rarely. The following C# example shows how a table is accessed through a global table buffer. The first row of the table (the RM Customer Master table) is retrieved, and the customer number is displayed. Notice how the table buffer is closed at the end of the example.
RmCustomerMstrTable CustomerMasterTable; CustomerMasterTable = Dynamics.Tables.RmCustomerMstr; // Read the first row of the table CustomerMasterTable.GetFirst(); // Display the name for the row retrieved MessageBox.Show(CustomerMasterTable.CustomerName.Value); // Close the table buffer CustomerMasterTable.Close();

PROGRAMMERS

GUIDE

43

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Keys
A key is a field or combination of fields in a table that is used to sort and locate specific rows in the table. Typically, the value of the key field or fields is unique for each row in a table so a specific row can be located. Keys that dont uniquely identify a specific row are used to refer to a range of rows in the table. The keys for a table are identified by number, beginning with the value 1. When you specify the key you want to use for a table, you will supply the corresponding integer. The Table Descriptions window in Microsoft Dynamics GP lists the keys for each table, and the key segments (fields) that each key contains.

The keys for the table are listed in numeric order. The fields in each key are listed here.

You will use the keys for a table when you retrieve a specific row from the table. This is described in the next section, Retrieving a row. You will also use keys when you want to perform operations on a range of rows in the table. You will learn more about this in Ranges on page 49.

Retrieving a row
Retrieving a row from a table is a multi-step process. First, you must decide which key you want to use to retrieve the row. Use the Table Descriptions window in Microsoft Dynamics GP to view the keys and each keys components. Specify the key to use, and then set the values of the key fields. Finally, use the Get() or Change() method for the table to retrieve the record. Which you use depends on whether you want to lock the record. You will learn more about locking in Row locking on page 53. The following C# example retrieves the row for the customer American Electrical Contractor from the RM_Customer_MSTR table. The second key of the RM_Customer_MSTR table is used. This key contains one component, the Customer Name. The contact person for the retrieved customer is displayed in a dialog.
// Variable for any table operation error TableError err; // Create a reference to the table RmCustomerMstrTable CustomerMasterTable; CustomerMasterTable = Dynamics.Tables.RmCustomerMstr; // Set the key to use for the table // Key 2 - Contains the Customer Name CustomerMasterTable.Key = 2; // Set the value for the key columns CustomerMasterTable.CustomerName.Value = "American Electrical Contractor";

44

P R O G R A M M E R S

G U I D E

C H A P T E R

WO R K IN G

WIT H

T A B LE S

// Retrieve the row err = CustomerMasterTable.Get(); if (err == TableError.NoError) { MessageBox.Show(CustomerMasterTable.ContactPerson.Value); } else { // Display the error that occurred MessageBox.Show(err.ToString()); } // Close the table CustomerMasterTable.Close();

Saving a row
To save a new row in a table, set the fields in the table to the values you want to save. Then use the Save() method to save the new row in the table. The following C# example adds a new row to the GL_Account_Category_MSTR table. It sets the values for the fields in the table, then saves the new row.
// Variable for any table operation error TableError err; // Create a reference to the table GlAccountCategoryMstrTable CategoryMasterTable; CategoryMasterTable = Dynamics.Tables.GlAccountCategoryMstr; // Set the fields in the table CategoryMasterTable.AccountCategoryNumber.Value = (short)49; CategoryMasterTable.AccountCategoryDescription.Value = "Profit Sharing"; // Save the new row err = CategoryMasterTable.Save(); if(err == TableError.Duplicate) { MessageBox.Show("Account category already exists"); } // Close the table CategoryMasterTable.Close();

PROGRAMMERS

GUIDE

45

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Updating a row
To update a row in a table, first read the row with the Change() method. This retrieves the row and locks it, allowing you to make changes. Set the values of the fields you want to change for the row. Finally, use the Save() method to save the changed row back to the table. The following C# example reads the row for Adam Park Resort. The Contact Person for this row is changed the Steve K. Then the row is saved back to the RM_Customer_MSTR table.
// Variable for any table operation error TableError err; // Create a reference to the table RmCustomerMstrTable CustomerMasterTable; CustomerMasterTable = Dynamics.Tables.RmCustomerMstr; // Set the key to use for the table // Key 1 - Contains the Customer Number CustomerMasterTable.Key = 1; // Set the key field in the table CustomerMasterTable.CustomerNumber.Value = "ADAMPARK0001"; // Attempt to read the row. The Change() method will lock the row. err = CustomerMasterTable.Change(); if (err == TableError.NoError) { // The row was read successfully, so update the value CustomerMasterTable.ContactPerson.Value = "Steve K."; // Save the updated row err = CustomerMasterTable.Save(); if (err != TableError.NoError) { MessageBox.Show("An error occurred updating the row: " + err.ToString()); } } else { MessageBox.Show("An error occurred retrieving the row to update: " + err.ToString()); } // Close the table CustomerMasterTable.Close();

46

P R O G R A M M E R S

G U I D E

C H A P T E R

WO R K IN G

WIT H

T A B LE S

Removing a row
To remove a row from a table, first read the row with the Change() method. This retrieves the row and locks it. Then use the Remove() statement to remove the row from the table. The following C# example reads and locks the row for the inventory item WIRE100 in the IV_Item_MSTR table. If the item is successfully read, it is removed from the table.
// Variable for any table operation error TableError err; // Create a reference to the table IvItemMstrTable ItemMasterTable; ItemMasterTable = Dynamics.Tables.IvItemMstr; // Set the key to use for the table // Key 1 - Contains the Item Number ItemMasterTable.Key = 1; // Set the key field in the table ItemMasterTable.ItemNumber.Value = "WIRE100"; // Attempt to read the row. The Change() method will lock the row. err = ItemMasterTable.Change(); if (err == TableError.NoError) { // Attempt to remove the row err = ItemMasterTable.Remove(); if (err != TableError.NoError) { MessageBox.Show("An error occured removing the row: " + err.ToString()); } } // Close the table ItemMasterTable.Close();

PROGRAMMERS

GUIDE

47

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Table operation errors


An error code is returned from each of the table operations that can be performed. The possible error codes are contained in the TableError enumeration. Many of the errors included in the enumeration will not occur in the released versions of Microsoft Dynamics GP. The following table describes the error values that your Visual Studio Tools integration is likely to encounter:
Constant
Changed DatabasePermissionViolation DoubleLock Duplicate EndOfTable InvalidKeyNumber NoError NoLock NotFound NotSupported

Description
The row being saved was changed by another user. The current user does not have security privileges to access the table. A row was already locked in the table buffer. The row being saved already exists in the table. The row cannot be retrieved because the beginning or end of the table has been reached. The table does not have a key with the number specified. No error occurred. An operation such as Remove() was performed, but no row had been locked. The row was not found in the table. The table operation is not supported for the table. For example, attempting to actively lock a row on a table that doesnt allow it. The row is actively locked by another user. Too many tables are open in the application. An unknown error occurred.

Sharing TooManyOpenTables Unknown

Typically, your code will do one or both of the following after each table operation: Check for the NoError value, indicating the table operation was successful. If the operation was successful, the next processing step can continue. Check for a specific error, such as NotFound. The code must respond appropriately, such as displaying a message for the user.

If an unexpected error occurs after performing a table operation, its always a good idea to display the details of the error to the user. Include information such as the table, the operation being performed, and the error that occurred. When a table operation error occurs, your code wont follow the typical code path. Be sure that your code closes any tables it has accessed. Otherwise, the user wont be able to exit Microsoft Dynamics GP.

48

P R O G R A M M E R S

G U I D E

C H A P T E R

WO R K IN G

WIT H

T A B LE S

Ranges
When working with tables, it is often efficient to limit the amount of information being accessed. You can do this by setting up a range for the table. A range is based on a key for the table, and allows you to access a specified portion of the rows in the table. The selected range will be treated as an entire table. For instance, calling the GetFirst() method returns the first row in the range. Calling the GetLast() method returns the last row in the range, and so on. You use the RangeStart() and RangeEnd() methods to specify the range for a table. You can specify one range per table, and the range is associated with a specific key. The range will be used only when the table is accessed using the key the range is associated with. To clear the range specified for a table, use the RangeClear() method.

Example 1 - Range with simple key


In the following C# example, a range is used to limit the rows accessed to only those customers whose names begin with A. Notice that the second key for the table, composed of the Customer Name field, is used for the RangeStart() and RangeEnd() methods. The first and last rows in the range are displayed.
// Variable for any table operation error TableError err; // Create a reference to the table RmCustomerMstrTable CustomerMasterTable; CustomerMasterTable = Dynamics.Tables.RmCustomerMstr; // Set the key to use for the table // Key 2 - Contains the Customer Name CustomerMasterTable.Key = 2; // Specify the start of the range CustomerMasterTable.Clear(); CustomerMasterTable.CustomerName.Value = "A"; CustomerMasterTable.RangeStart(); // Specify the end of the range CustomerMasterTable.Clear(); CustomerMasterTable.CustomerName.Value = "B"; CustomerMasterTable.RangeEnd(); // Display the first item in the range err = CustomerMasterTable.GetFirst(); if (err == TableError.NoError) { MessageBox.Show("First customer: " + CustomerMasterTable.CustomerName.Value); } else { MessageBox.Show("An error occured retrieving the row: " + err.ToString()); }

PROGRAMMERS

GUIDE

49

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

// Display the last item in the range err = CustomerMasterTable.GetLast(); if (err == TableError.NoError) { MessageBox.Show("Last customer: " + CustomerMasterTable.CustomerName.Value); } else { MessageBox.Show("An error occured retrieving the row: " + err.ToString()); } // Close the table CustomerMasterTable.Close();

Example 2 - Range with multi-segment key


If a key is composed of several segments, you can create ranges based on serveral key segments. Its important that all segments of the key be set when specifying the start and end of the range. The Clear() and Fill() methods are often used when creating a range based on a multi-segment key. They are used to set all of the fields in the table buffer to the empty value or the filled value. This ensures that all of the key segments have been specified before the RangeStart() or RangeEnd() methods are called. For example, the following C# code creates a range for the IV_Item_MSTR table that includes only items in the COMPONENTS class. The range is created using key 3 for the Item Master table. This key has two segments: Item Class Code and Item Number. To set the beginning of the range, the Clear() method is used to set the fields in the IV_Item_MSTR table buffer to the minimum value. The Item Class Code field in the table buffer is set to COMPONENTS. The RangeStart() method specified this is the beginning of the range. To set the end of the range, the Fill() method is used to set the fields in the IV_Item_MSTR table buffer to the maximum value. The Item Class Code field in the table buffer is set to COMPONENTS. The RangeEnd() method specifies this is the end of the range. The key values for the range are shown in the following illustration. The range will include rows where the Item Class Code value is COMPONENT and the Item Number can be any value.
Item Class Code Range Start COMPONENT Item Number (Cleared)

Range End

COMPONENT

(Filled)

50

P R O G R A M M E R S

G U I D E

C H A P T E R

WO R K IN G

WIT H

T A B LE S

// Variable for any table operation error TableError err; // Create a reference to the table IvItemMstrTable ItemMasterTable; ItemMasterTable = Dynamics.Tables.IvItemMstr; // Set the key to use for the table // Key 3 - Contains the Item Class Code and the Item Number ItemMasterTable.Key = 3; // Specify the start of the range ItemMasterTable.Clear(); ItemMasterTable.ItemClassCode.Value = "COMPONENTS"; ItemMasterTable.RangeStart(); // Specify the end of the range ItemMasterTable.Fill(); ItemMasterTable.ItemClassCode.Value = "COMPONENTS"; ItemMasterTable.RangeEnd(); // Read through the items in the range StringBuilder itemList = new StringBuilder(); err = ItemMasterTable.GetFirst(); while(err == TableError.NoError) { // Add the item to the list itemList.AppendLine(ItemMasterTable.ItemNumber + " ItemMasterTable.ItemDescription); // Get the next item in the range err = ItemMasterTable.GetNext(); } // Display the list of items MessageBox.Show(itemList.ToString()); // Close the table ItemMasterTable.Close(); " +

Example 3 - Removing rows in a range


Once a range is created for a table, you can use the RangeRemove() method to remove all of the rows in that range from the table. In many cases, this will be faster than removing individual rows using the Remove() method. The following C# example deletes all customer information for St. Patricks Hospital. A single row must be deleted from the RM_Customer_MSTR and the RM_Customer_MSTR_SUM tables. Several rows must be deleted from the RM_Customer_MSTR_ADDR table. A range is used to remove the rows from this table.
// Variable for any table operation error TableError err;

PROGRAMMERS

GUIDE

51

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

// Create references to the tables RmCustomerMstrTable CustomerMasterTable; CustomerMasterTable = Dynamics.Tables.RmCustomerMstr; RmCustomerMstrSumTable CustomerMasterSummaryTable; CustomerMasterSummaryTable = Dynamics.Tables.RmCustomerMstrSum; RmCustomerMstrAddrTable CustomerMasterAddressTable; CustomerMasterAddressTable = Dynamics.Tables.RmCustomerMstrAddr; // Delete the row from the Customer Master Summary table CustomerMasterSummaryTable.Key = 1; CustomerMasterSummaryTable.CustomerNumber.Value = "STPATRIC0001"; err = CustomerMasterSummaryTable.Change(); if (err == TableError.NoError) { err = CustomerMasterSummaryTable.Remove(); } // Close the table CustomerMasterSummaryTable.Close(); // Delete the row from the Customer Master table CustomerMasterTable.Key = 1; CustomerMasterTable.CustomerNumber.Value = "STPATRIC0001"; err = CustomerMasterTable.Change(); if (err == TableError.NoError) { err = CustomerMasterTable.Remove(); } // Close the table CustomerMasterTable.Close(); // Delete the rows from the Customer Master Address table // Key 1 has two segments (Customer Number and Address Code) CustomerMasterAddressTable.Key = 1; // Specify the start of the range CustomerMasterAddressTable.Clear(); CustomerMasterAddressTable.CustomerNumber.Value = "STPATRIC0001"; CustomerMasterAddressTable.RangeStart(); // Specify the end of the range CustomerMasterAddressTable.Fill(); CustomerMasterAddressTable.CustomerNumber.Value = "STPATRIC0001"; CustomerMasterAddressTable.RangeEnd(); // Remove the rows from the range CustomerMasterAddressTable.RangeRemove(); // Close the table CustomerMasterAddressTable.Close();

52

P R O G R A M M E R S

G U I D E

C H A P T E R

WO R K IN G

WIT H

T A B LE S

Row locking
A row must be locked to delete it or save any changes made to it. A lock is applied when a row is read from a table. Two types of locked can be used: passive and active.

Passive locking
A passive lock allows other users to access the row. They can delete the row or make changes to it. Passive locking ensures that other users accessing the row can be made aware that the row has been deleted or that the contents of the row have changed. A pasive lock is applied every time a row is read using the Change() method. The Get() method is used only to read a row. It never locks the row.

Active locking
An active lock allows other users to read the row, but not make any changes or delete the row. Active locking ensures that the user who has the active lock is the only user who can make changes or delete the row. If other users try to delete or change the row, they will receive a sharing error. An ative lock is applied each time a row is read using the Change() method and the activeLock parameter for the method is set to true. Not all tables in Microsoft Dynamics GP allow active locking. If you try to actively lock a row on a table that doesnt support it, a NotSupported error will be returned.

Releasing locks
Any of the following actions release a row lock: Using the Release() method. Using the Save() method or the Remove() method, regardless of whether the method was successful.

If a row is currently locked in a table buffer, and you attempt to lock another row, you will receive an DoubleLock error that indicates a row was already locked.

Multiuser processing
Microsoft Dynamics GP supports multiple users accessing the same table at the same time. This is accomplished through Optimistic Concurrency Control (OCC), a form of record locking that allows multiple users to work in the same tables and access the same rows with minimal restrictions, while helping to ensure data integrity. To allow multiple users to successfully use Microsoft Dynamics GP while Visual Studio Tools integrations are accessing data, you must choose the type of locking used. You must also handle any error conditions that occur as a result of multiple users working with the same row in a table.

PROGRAMMERS

GUIDE

53

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

The following table lists the various locking scenarios that can occur. The events listed happen in order from left to right. For example, in the first row User A passively locks a row, then User B passively locks the same row. User A deletes the row, then User B changes the contents of the row and saves the row. The changes User B made will be saved.
User A
1 Passively locks a row.

User B
Passively locks the same row.

User A
Deletes the row.

User B

Result

The changes User B made will be Changes the contents of the row saved. and saves the changes. The row will be deleted.

Passively locks a row. Passively locks a row. Passively locks a row. Passively locks a row. Actively locks a row.

Passively locks the same row. Passively locks the same row. Passively locks the same row. Passively locks the same row. Passively locks the same row.

Deletes the row. Changes the contents of the row and saves the row. Changes a field and saves the row. Changes a field and saves the row. Deletes the row. Keeps the active lock. Changes a different field and saves the row. Changes the same field and attempts to save the row. Attempts to delete the row.

Both changes will be saved.

User B will get an error indicating the row changed. User Bs changes wont be saved. User B will get an error indicating the row is missing.

5 6

Attempts to delete User B will get a row locked error. the row or change The row wont be deleted or the a field and save the changes wont be saved. row. Changes the row and saves it or deletes the row. If user B changed the row and saved, the changes will be saved. If User B attempts to delete the row, User B will get an error indicating the row is missing. If User B changed the same field as User A, User B will get an error indicating the row changed. User Bs changes wont be saved. If user B changed different fields, the changes will be saved. If User B deleted the row, the row will be deleted. User A will get a row locked error, even though User Bs active lock came later than User As lock. User B will get a row locked error.

Actively locks a row.

Passively locks the same row.

Deletes the row. The active lock is released.

Actively locks a row.

Passively locks the same row.

Makes changes and saves the row. The active lock is released.

Changes the row and saves it or deletes the row.

Passively locks a row.

Actively locks the Attempts to delete Keeps the active same row. the row or change lock. a field and save the row. Attempts to actively lock the same row.

10

Actively locks a row.

Scenarios 1 through 3 dont produce any errors. To be multiuser compatible, your application should be able to handle scenarios 4 to 10, alerting users that an error occurred, and allowing them to respond appropriately. Use the error value returned from the various table operations like Save() or Remove() to trap errors so your code can deal with the errors that occur. The following examples show how to trap for multiuser errors when reading, saving and removing records. You should not check for multiuser error conditions on tables containing text fields. Text fields are those that store text up to 32,000 characters long. Multiuser error codes are not properly returned for tables containing text fields.

54

P R O G R A M M E R S

G U I D E

C H A P T E R

WO R K IN G

WIT H

T A B LE S

Example 1
The following C# example reads and actively locks the first row in the RM_Sales_WORK table. It uses the value returned from the ChangeFirst() method to handle the Sharing error resulting from the row being actively locked by another user.
// Variable for any table operation error TableError err; // Create references to the tables RmSalesWorkTable SalesWorkTable; SalesWorkTable = Dynamics.Tables.RmSalesWork; // Release any existing lock SalesWorkTable.Release(); // Retrieve the first row and actively lock it err = SalesWorkTable.ChangeFirst(true); if (err == TableError.Sharing) { // The row is actively locked by another user MessageBox.Show("This row is currently locked by another user."); } // Close the table SalesWorkTable.Close();

Example 2
The following C# example reads the first row of the RM_Customer_MSTR table, changes the Salesperson ID, and attempts to save the changed row. The return value from the Save() method is used to handle an error resulting from the row being changed or actively locked by another user.
// Variable for any table operation error TableError err; // Create reference to the table RmCustomerMstrTable CustomerMasterTable; CustomerMasterTable = Dynamics.Tables.RmCustomerMstr; // Release any existing lock CustomerMasterTable.Release(); // Read the first row in the table err = CustomerMasterTable.ChangeFirst(); // Change the Salesperson ID CustomerMasterTable.SalespersonId.Value = "STEVE K."; // Save the changed row err = CustomerMasterTable.Save(); // Handle any errors if (err == TableError.Changed) { // The row was changed by another user. MessageBox.Show("This row has been changed by another user. Their changes will be overridden.");

PROGRAMMERS

GUIDE

55

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

// Re-read the current row to lock it CustomerMasterTable.Change(); // Re-write the value CustomerMasterTable.SalespersonId.Value = "STEVE K."; // Attempt the save again err = CustomerMasterTable.Save(); if (err != TableError.NoError) { MessageBox.Show("Customer could not be updated."); } } else if (err == TableError.Sharing) { MessageBox.Show("This row is actively locked by another user. Changes will not be saved."); } else if (err != TableError.NoError) { // Some other table error occurred MessageBox.Show("An error occured updating the customer: " + err.ToString()); } // Close the table CustomerMasterTable.Close();

Example 3
The following script reads the last row in the GL_Account_Category_MSTR table and attempts to delete it. The error value returned from the Remove() method is used to handle an error resulting from the row being actively locked or already deleted by another user.
// Variable for any table operation error TableError err; // Create reference to the table GlAccountCategoryMstrTable AccountCategoryMasterTable; AccountCategoryMasterTable = Dynamics.Tables.GlAccountCategoryMstr; // Release any lock on the row AccountCategoryMasterTable.Release(); // Retrieve the last row err = AccountCategoryMasterTable.ChangeLast(); if (err == TableError.NoError) { // Row was read and can be removed err = AccountCategoryMasterTable.Remove(); if (err == TableError.Sharing) {

56

P R O G R A M M E R S

G U I D E

C H A P T E R

WO R K IN G

WIT H

T A B LE S

// The row is actively locked MessageBox.Show("This row is actively locked by another user. It cannot be removed."); } else if (err == TableError.NotFound) { // The row was removed by another user MessageBox.Show("This row was removed by another user."); } else if (err != TableError.NoError) { // Some other table error occurred MessageBox.Show("An error occured removing the row: " + err.ToString()); } } else { // Some other table error occurred MessageBox.Show("An error occured retrieving the row: " + err.ToString()); } // Close the table AccountCategoryMasterTable.Close();

PROGRAMMERS

GUIDE

57

58

P R O G R A M M E R S

G U I D E

Chapter 10:

Building and Deploying


This portion of the documentation describes how to build and deploy an integration created with Visual Studio Tools for Microsoft Dynamics GP. Information is divided into the following sections: Setting assembly information Building an integration Deploying an integration

Setting assembly information


Its important to set the assembly information so the assembly you build for your Visual Studio Tools for Microsoft Dynamics GP integration is properly identified and versioned. Be sure you set the following items: Title Description Company Major, minor, and build numbers

C# application
For integrations written in C#, the assembly information is set in the AssemblyInfo.cs source file for the project. The following portion of this file shows the various name values that should be set.
// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Estimate Freight")] [assembly: AssemblyDescription("Estimate Freight Sample Integration")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("EstimateFreight")] [assembly: AssemblyCopyright("Copyright Microsoft 2008")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]

The following portion of this file shows the version, build, and revision numbers that should be set.
// Version information for an assembly consists of the following four values: // // // // // // // You can specify all values or default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] Major Version Minor Version Build Number Revision

PROGRAMMERS

GUIDE

59

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Visual Basic application


For integrations written in Visual Basic, the assembly information is set in the Assembly Information window. Access this window. To view this windows, choose to display the properties for the Visual Basic project. Click the Application tab, and then click the Assembly Information button.

Building an integration
To build the integration, complete the following procedure: 1. Set the solution configuration. If youre building a test version of the integration, set the solution configuration to Debug. If you are building a final version of the integration, set the solution configuration to Release.
Set the solution configuration to either Debug or Release.

2. Build the solution. Choose Build Solution from the Build menu. 3. Verify there were no build warnings. If there were build warnings, fix them and build again. 4. Copy the assembly to the AddIns folder. Copy the assembly for your integration from the Debug or Release folder for your project to the AddIns folder in the Microsoft Dynamics GP installation. 5. Copy any application assemblies needed. If you created any application assemblies for your integration, be sure to copy them to the Microsoft Dynamics GP folder. 6. Start Microsoft Dynamics GP . Your integrating application should be loaded when Microsoft Dynamics GP starts. Verify that your integration is working properly.

60

P R O G R A M M E R S

G U I D E

C H A P T E R

1 0

B U I LD IN G

A N D

D EP LO Y IN G

Deploying an integration
When deploying your integration built with Visual Studio Tools for Microsoft Dynamics GP, be sure that you include the following: The assembly for your integration. Any additional application assemblies you generated that are specific to your integration. Instructions that explain how to install your integration.

PROGRAMMERS

GUIDE

61

62

P R O G R A M M E R S

G U I D E

Chapter 11:

Debugging
When developing an integrating application, you may find it necessary to examine the code with the Visual Studio debugger. Information about debugging your Microsoft Dynamics GP integration is divided into the following sections: Preparing to debug Examining the application Disabling events

Preparing to debug
To prepare your integrating application for debugging, complete the following procedure. 1. Build and deploy the integration. Be sure that you have built the Debug version of your project. 2. Start Microsoft Dynamics GP . Microsoft Dynamics GP must be running so that your integrating application is loaded. 3. Set breakpoints in your code. Within Visual Studio, set breakpoints in your code to indicate where you want processing to wait. 4. Choose to attach to a process. Since your integrating application is running within the Dynamics.exe process, you must attach the Visual Studio debugger to this process. From within Visual Studio, choose Attach to Process from the Debug menu. 5. Select the Dynamics.exe process. In the Attach to Process window, locate the Dynamics.exe process and select it in the list.

Locate the Dynamics.exe process and select it in the list.

Click Attach to attach to the process. Control will be returned to Visual Studio.

PROGRAMMERS

GUIDE

63

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

Examining the application


Once your integrating application has stopped at a breakpoint, you can use Visual Studios tools to examine your code. Do the following: 1. Switch to Microsoft Dynamics GP . 2. Perform the actions to exercise your code. Within Microsoft Dynamics GP, perform the actions that will execute the code you want to examine. 3. Examine your code. When Visual Studio encounters a breakpoint, it will become the active application. Use the tools within Visual Studio to examine your code.
Examine your code while stopped at the breakpoints you set.

4. Finish debugging. When you have finished debugging your integrating application, choose Stop Debugging from the Debug menu in Visual Studio.

Disabling events
In some cases, you may want to disable the events for the Visual Studio Tools addins to confirm whether they are causing some specific behavior in the Microsoft Dynamics GP application. To disable events, use the Customization Status window in Microsoft Dynamics GP. To open this window, point to Customize in the Tools menu, and then choose Customization Status. Select the Microsoft Dynamics GP product, and then click Disable. Be sure to enable the events after you have completed your tests.

64

P R O G R A M M E R S

G U I D E

Chapter 12:

Modified and Alternate Forms


To access modified or alternate forms from a Visual Studio Tools for Microsoft Dynamics GP, a special process is used. This portion of the documentation describes the steps necessary. Information is divided into the following sections: Modified forms Alternate forms Guidelines

Modified forms
Modified forms contain modifications that have been made with the Modifier. To access these modifications from your Visual Studio Tools for Microsoft Dynamics GP project, complete the following procedure: 1. Create an application assembly for the forms dictionary. If the forms dictionary for the application that has been modified doesnt have an application assembly, create one using the process described in Chapter 6, Dictionary Assembly Generator. For example, the following command creates the application assembly for the forms dictionary of the core Dynamics GP product:
dag.exe 0 "C:\Program Files\Microsoft Dynamics\GP\Dynamics.set" /F /N:Dynamics

The /N option is necessary because the application assembly uses the name Dynamics, while the product name in the launch file is Microsoft Dynamics GP. 2. Add the reference to the application assembly for your project. In Visual Studio, add the reference to the application assembly. The following illustration show the reference added for the application assembly that provides access to modified forms for the Dynamics GP core dictionary.

This reference to the application assembly provides access to the modified forms for the application.

3. Access the modified forms. Modified forms are accessed through an additional dictionary class that has the same name as the applications dictionary class, but with the additional phrase Modified. For instance, the dictionary class used to access modified forms for the Dynamics core application is: DynamicsModified

PROGRAMMERS

GUIDE

65

PA RT

D E V E L O PI N G

I N TE G R A T I O N S

The following C# code sets the value of a new field on the Credit Limit window of the Customer Maintenance form. The new field is a local field, added with the Modifier, and named Test.
DynamicsModified.Forms.RmCustomerMaintenance.RmCreditLimit.LocalTest.Value = "Modified Field";

When accessing resources that are defined in the main dictionary for an application, access them through the main dictionary class, rather than through the Modified class for the application.

Alternate forms
Alternate forms are forms from the core Dynamics dictionary that have been changed by a third-party developer, and are stored in a third-party dictionary. The new and changed resources for the alternate form are accessed through the thirdparty applications application assembly. To access alternate forms from you Visual Studio Tools for Microsoft Dynamics GP project, complete the following procedure: 1. Create an application assembly for the third-party dictionary. If the third-party dictionary doesnt already have an application assembly, create one using the process described in Chapter 6, Dictionary Assembly Generator. For example, the following command creates the application assembly for the Sample Integrating Application, to which an alternate form (PM Vendor Maintenance) was added for this example:
dag.exe 3333 "C:\Program Files\Microsoft Dynamics\GP\Dynamics.set" /M

2. Add the reference to the application assembly for your project. In Visual Studio, add the reference to the application assembly. The following illustration show the reference added for the application assembly that provides access to the alternate forms in the Sample Integrating App application.

This reference to the application assembly provides access to the alternate forms for the application.

3. Access the alternate forms. Alternate forms are accessed through the dictionary class for the assembly that contains them. For instance, the alternate forms in the Sample Integrating App application would be accessed through its dictionary class: SampleIntegratingApp

66

P R O G R A M M E R S

G U I D E

C H A P T E R

1 2

M O D IFI ED

A N D

AL T ER N AT E

F O R M S

The following C# code sets the value of a new field on the Vendor Maintenance window of the alternate version of the Vendor Maintenance form, which is part of the Sample Integrating App dictionary. The new field is a local field named Test.
SampleIntegratingApp.Forms.PmVendorMaintenance.PmVendorMaintenance. LocalTest.Value = "Alternate Field";

Guidelines
If you are planning to use Visual Studio Tools for Microsoft Dynamics GP to develop an integration for general distribution, we recommend that you limit the references to resources on modified or alternate forms. Because of security settings, a specific user may not have access to the modified or alternate version of a form, possibly causing errors in your integration. If you do distribute an integration which accesses modified or alternate forms, be sure that your code properly handles cases when these resources are not available. For instance, when you set or retrieve the value of a field, use a try...catch block to enclose the statements. This allows your code to catch any exceptions that are thrown because the field cannot be accessed. The following C# example shows how a field in window for an alternate version of the Vendor Maintenance form can be set within a try...catch block.
// Set the Status local field in the alternate form try { SampleIntegratingApp.Forms.PmVendorMaintenance.PmVendorMaintenance. LocalStatus.Value = "Preferred"; } catch (Exception ex) { // The field was not accessible. In this example, display a message. MessageBox.Show(ex.Message); }

PROGRAMMERS

GUIDE

67

68

P R O G R A M M E R S

G U I D E

PART 3: RESOURCE REFERENCE

Part 3: Resource Reference


This portion of the documentation provides detailed information about each type of resource you can access with Visual Studio Tools for Microsoft Dynamics GP. Each resource has the following: Information about accessing the resource A list of methods A list of properties A list of events

The following resources are discussed: Chapter 13, Forms, describes form resources. Chapter 14, Windows, describes window resources. Chapter 15, Scrolling Windows, describes scrolling window resources. Chapter 16, Window Fields, describes window field resources. Chapter 17, Tables, describes table resources. Chapter 18, Table Fields, describes table field resources. Chapter 19, Commands, describes command resources. Chapter 20, Globals, describes global variable resources. Chapter 21, Procedures, describes procedure resources. Chapter 22, Functions, describes function resources.

70

P R O G R A M M E R S

G U I D E

Chapter 13:

Forms
Forms are the basic resource of the Microsoft Dynamics GP application. They provide the organization for the interface presented to the user. The following items for forms are discussed: Accessing forms Form methods Form properties Form events

Accessing forms
Forms for an application dictionary are accessed through the dictionary class. This class has a Forms property that provides access to the collection of forms in the dictionary. The dictionary class for the application dictionary is located in the following namespace: Microsoft.Dexterity.Applications For instance, to access the collection of forms in the Dynamics dictionary, use the following syntax: Microsoft.Dexterity.Applications.Dynamics.Forms To access a specific form, such as the Sales Transaction Entry form (SopEntry), use the following syntax: Microsoft.Dexterity.Applications.Dynamics.Forms.SopEntry

Form methods
Forms provide the following methods: AddMenuHandler() Close() Dispose() Open()

AddMenuHandler()
The AddMenuHandler() method adds a menu item to the Additional menu that appears in windows in Microsoft Dynamics GP. The menu item will be available when the form is open. This method takes three parameters: EventHandler The function that will be run when the menu item is chosen in Microsoft Dynamics GP. MenuItemName A string containing the text that will be displayed for the menu item. AcceleratorKey A string containing a single character that will be used as the accelerator key for the menu item. Be sure this accelerator key does not conflict with any existing accelerator keys. If you dont want an accelerator key, use the empty string.

PROGRAMMERS

GUIDE

71

PA RT

R E S O U R C E

R E F E R E N C E

The following C# example shows how a menu handler for the Estimate Freight menu item is added to the SopEntry form in Microsoft Dynamics GP:
Dynamics.Forms.SOPEntry.AddMenuHandler(OpenEstimateFreight, "Estimate Freight", "F");

This code is the event handler for the menu item. Notice that it takes two arguments like standard event handlers.
static void OpenEstimateFreight(object sender, EventArgs e) { if (EstimateFreightForm == null) { EstimateFreightForm = new EstimateFreight(); } else { if (EstimateFreightForm.Created == false) { EstimateFreightForm = new EstimateFreight(); } } // Always show and activate the WinForm EstimateFreightForm.Show(); EstimateFreightForm.Activate(); } }

The following Visual Basic example shows how the same menu handler for the Estimate Freight menu item is added to the SopEntry form in Microsoft Dynamics GP.
Dim EstimateFreightHandler as System.EventHandler EstimateFreightHandler = New System.EventHandler(AddressOf OpenEstimateFreight) Dynamics.Forms.SOPEntry.AddMenuHandler(EstimateFreightHandler, "Estimate Freight", "F")

This code is the event handler for the menu item. Notice that it also takes two arguments like standard event handlers.
Shared Sub OpenEstimateFreight(ByVal sender As Object, ByVal e As EventArgs) If EstimateFreightForm Is Nothing Then Try EstimateFreightForm = New EstimateFreightForm() Catch ex As Exception MessageBox.Show(ex.Message) End Try Else If EstimateFreightForm.Created = False Then EstimateFreightForm = New EstimateFreightForm() End If End If

72

P R O G R A M M E R S

G U I D E

C H A PT E R

1 3

F O R M S

' Always show and activate the WinForm EstimateFreightForm.Show() EstimateFreightForm.Activate() End Sub

Close()
The Close() method closes the form.

Dispose()
The Dispose() method releases the memory used for the form after it is no longer needed.

Open()
The Open() method attempts to open the form.

Form properties
Forms provide the following properties: Commands Functions IsOpen Procedures

Commands
The Commands property provides access to the list of commands that are defined by the form. Refer to Chapter 19, Commands, to learn more about using commands in your application.

Functions
The Functions property provides access to the list of form-level functions that are defined by the form. Refer to Chapter 22, Functions, for more information about functions.

IsOpen
The IsOpen property has the value true if the form is open, and false if it is not.

Procedures
The Procedures property provides access to the list for form-level procedures that are defined by the form. Refer to Chapter 21, Procedures, to learn more about using procedures.

Tables
The Tables property provides access to the list of tables that are attached to the form. Refer to Chapter 9, Working with Tables, and Chapter 17, Tables, for more information about using the tables attached to forms.

PROGRAMMERS

GUIDE

73

PA RT

R E S O U R C E

R E F E R E N C E

Form events
Forms provide the following events: OpenBeforeOriginal OpenAfterOriginal CloseBeforeOriginal CloseAfterOriginal

OpenBeforeOriginal
This event occurs when the form is opened, but before the forms open event is run. This event can be canceled.

OpenAfterOriginal
This event occurs when the form is opened, but after the forms open event is run.

CloseBeforeOriginal
This event occurs when the form is closed, before the forms close event is run. This event can be canceled.

CloseAfterOriginal
This event occurs when the form is closed, after the forms close event is run.

74

P R O G R A M M E R S

G U I D E

Chapter 14:

Windows
Windows are a part of form in Microsoft Dynamics GP. They display the user interface for the application. The following items are discussed: Accessing windows Window methods Window properties Window events

Accessing windows
Windows for an application dictionary are accessed as properties of the form that they are contained in. For example, the Sales Transaction Entry window (SopEntry) is part of the SopEntry form. To access it, you would use the following syntax: Dynamics.Forms.SopEntry.SopEntry The IntelliSense in Visual Studio will tell you what form and window in Microsoft Dynamics GP are being referred to by the expression.

Window methods
Windows provide the following methods: Close() Open() PullFocus()

Close()
The Close() method closes the window.

Open()
The Open() method attempts to open the window.

PullFocus()
The PullFocus() method will remove the focus from the current window. No item in the window will be focused. Any pending validate or leave events for the currently-focused field will be run. Use this method in situations where you want all of the pending actions to be run before your integrating application performs its processing.

Window properties
Windows provide the following property: IsOpen

IsOpen
The IsOpen property has the value true if the window is open, and false if it is not.

PROGRAMMERS

GUIDE

75

PA RT

R E S O U R C E

R E F E R E N C E

Window events
Windows provide the following events: OpenBeforeOriginal OpenAfterOriginal ActivateBeforeOriginal ActivateAfterOriginal CloseBeforeOriginal CloseAfterOriginal PrintBeforeOriginal PrintAfterOriginal

OpenBeforeOriginal
This event occurs when the window is opened, but before the windows open event is run. This event can be canceled.

OpenAfterOriginal
This event occurs when the window is opened, but after the windows open event is run.

ActivateBeforeOriginal
This event occurs each time the window becomes active, before the windows activate event is run. The activate event occurs every time the window is opened or brought to the front by the user. It occurs after the Open event. The Activate event must be used cautiously. It shouldnt perform any actions that can cause dialogs to appear because the application can become suspended in an endless loop.

ActivateAfterOriginal
This event occurs each time the window becomes active, after the windows activate event is run.

CloseBeforeOriginal
This event occurs when the window is closed, but before the windows close event is run. This event can be canceled.

CloseAfterOriginal
This event occurs when the window is closed, but after the windows close event is run.

PrintBeforeOriginal
This event occurs when the print action for the window is chosen, but before the windows print event is run. The print action for a window occurs when the user chooses the Print menu item from the File menu, or clicks the Print button on the window. This event can be canceled.

PrintAfterOriginal
This event occurs when the print action for the window is chosen, but after the windows print event is run.

76

P R O G R A M M E R S

G U I D E

Chapter 15:

Scrolling Windows
Scrolling windows are a special type of window in Microsoft Dynamics GP that are used to display or access data directly from a database table. The following items are discussed: Accessing scrolling windows Scrolling window methods Scrolling window properties Scrolling window events

Accessing scrolling windows


Scrolling windows for an application dictionary are accessed as properties of the window that they are contained in. For example, the Line Scroll scrolling window in the Sales Transaction Entry window of Microsoft Dynamics GP is accessed using the following syntax: Dynamics.Forms.SopEntry.SopEntry.LineScroll The IntelliSense in Visual Studio will tell you what scrolling window in Microsoft Dynamics GP is being referred to by the expression.

Scrolling window methods


There are no additional methods for scrolling windows.

Scrolling window properties


There are no additional properties for scrolling windows.

Scrolling window events


Scrolling windows provide the following events: LineFillBeforeOriginal LineFillAfterOriginal LineEnterBeforeOriginal LineEnterAfterOriginal LineChangeBeforeOriginal LineChangeAfterOriginal LineLeaveBeforeOriginal LineLeaveAfterOriginal LineInsertBeforeOriginal LineInsertAfterOriginal LineDeleteBeforeOriginal LineDeleteAfterOriginal

LineFillBeforeOriginal
This event occurs before the line fill event for the scrolling window. The line fill event occurs each time a new line is added to the scrolling window from the linked table, such as when the user scrolls to a new line. When the scrolling window first fills, the line fill event occurs repeatedly until the scrolling window is full. The line fill event also occurs each time the user moves the focus to an existing line in the scrolling window. The line fill event occurs before the line enter event.

PROGRAMMERS

GUIDE

77

PA RT

R E S O U R C E

R E F E R E N C E

To find out what data will be added to the current row of the scrolling window, examine the current row of the form-level table buffer for the table linked to the scrolling window. When using this event, you cannot examine the window fields for the scrolling window to determine what row is being added. The values of the window fields will not have been set yet. The LineFillBeforeOriginal event can be cancelled. If the event is cancelled, the current row in the table linked to the scrolling window will not be added to the scrolling window. For example, the following C# code registers the LineFillBeforeOriginal event for the scrolling window in the Customers and Prospects window in Microsoft Dynamics GP.
public void Initialize() { Dynamics.Forms.CustomerLookup.CustomerLookup.CustomerLookupScroll. LineFillBeforeOriginal += new System.ComponentModel.CancelEventHandler (CustomerLookupScroll_LineFillBeforeOriginal); }

The following is the C# code that runs in response to this event. It allows only customers in the TERRITORY 2 sales territory to be displayed. The RmCustomerMstr table is linked to the scrolling window, so the values for the scrolling window come from this table. Notice how the code is accessing the current row of the form-level table buffer for the RmCustomerMstr table to find out what row is being added to scrolling window. The SalesTerritory field in the current row of the table is examined. If it is not TERRITORY 2, the event is cancelled. This prevents the row from being displayed in the scrolling window.
void CustomerLookupScroll_LineFillBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e) { if(Dynamics.Forms.CustomerLookup.Tables.RmCustomerMstr.SalesTerritory. Value != "TERRITORY 2") { // Not in TERRITORY 2, so do not display the line e.Cancel = true; } }

LineFillAfterOriginal
This event occurs after the line fill event for the scrolling window.

LineEnterBeforeOriginal
This event occurs when the focus moves to a line in the scrolling window, but before the scrolling windows line enter event is run. This event can be canceled.

LineEnterAfterOriginal
This event occurs when the focus moves to a line in the scrolling window, but after the scrolling windows line enter event is run.

78

P R O G R A M M E R S

G U I D E

C H A P T E R

1 5

S C R O L L I N G

W I N D O W S

LineChangeBeforeOriginal
This event occurs when the focus leaves a line in the scrolling window, and the contents of the line has been modified. The event runs before the scrolling windows line change event is run. This event can be canceled.

LineChangeAfterOriginal
This event occurs when the focus leaves a line in the scrolling window, and the contents of the line has been modified. The event runs after the scrolling windows line change event is run.

LineLeaveBeforeOriginal
This event occurs when the focus leaves a line in the scrolling window, but before the scrolling windows line leave event is run. This event can be canceled.

LineLeaveAfterOriginal
This event occurs when the focus leaves a line in the scrolling window, but after the scrolling windows line leave event is run.

LineInsertBeforeOriginal
This event occurs when a new line is added to the scrolling window, but before the scrolling windows line insert event is run. This event can be canceled.

LineInsertAfterOriginal
This event occurs when a new line is added to the scrolling window, but after the scrolling windows line insert event is run.

LineDeleteBeforeOriginal
This event occurs when a line is removed from the scrolling window, but before the scrolling windows line delete event is run. This event can be canceled.

LineDeleteAfterOriginal
This event occurs when a line is removed from the scrolling window, but after the scrolling windows line delete event is run.

PROGRAMMERS

GUIDE

79

80

P R O G R A M M E R S

G U I D E

Chapter 16:

Window Fields
Window fields display individual data items on a window. The following items are discussed: Accessing window fields Window field methods Window field properties Window field events

Accessing window fields


Windows fields for an application dictionary are accessed as properties of the window or scrolling window that they are contained in. For example, the SOP Number (SopNumber) field is available on the Sales Transaction Entry window (SopEntry). To access it, you would use the following syntax: Dynamics.Forms.SopEntry.SopEntry.SopNumber As another example, the QTY To Backorder (QtyToBackOrder) field is available on the Line Scroll (LineScroll) scrolling window of the Sales Transaction Entry window(SopEntry). To access this field, you would use the following syntax: Dynamics.Forms.SopEntry.SopEntry.LineScroll.QtyToBackOrder The IntelliSense in Visual Studio will tell you what field in Microsoft Dynamics GP is being referred to by the expression. Some fields in windows are called local fields, because they are used only within a specific form. For instance, the Sales Transaction Entry window (SopEntry) contains a local field named (L) BillTo Address 1. The (L) in the name is the standard way local fields are identified in Microsoft Dynamics GP. In a Visual Studio Tools for Microsoft Dynamics GP project, the names of these fields are prefixed with the Local to indicate they are local fields. For example, to access the BillTo Address 1 local field, you would use the following syntax: Dynamics.Forms.SopEntry.SopEntry.LocalBillToAddress1

Window field methods


Window fields provide the following methods: Clear() Disable() Enable() Fill() Focus() ForceValidate() Hide() Lock() RunValidate() Show() Unlock()

PROGRAMMERS

GUIDE

81

PA RT

R E S O U R C E

R E F E R E N C E

Clear()
The Clear() method sets the field to its cleared value. The following table lists the cleared value for standard datatypes:
Datatype
Date Currency Integer Long String Time

Cleared value
0/0/0 0 0 0 Empty string 000000 which corresponds to 12:00:00 AM

Disable()
The Disable() method makes the field appear in a disabled state, and prevents the user from making changes to the field.

Enable()
The Enable() method allows a previously disabled field to receive user input.

Fill()
The Fill() method sets the field to its filled value. The following table lists the filled value for standard datatypes:
Datatype
Date Currency Integer Long String

Filled value
12/31/9999 99999999999999.99999 32,767 2,147,483,647 The length byte (first byte) of the string is set to the storage size of the string minus 1. Each of the remaining bytes is set to string equivalent of ASCII 255. 23:59:59

Time

Focus()
The Focus() method moves the focus to the field.

ForceValidate()
The ForceValidate() method controls whether the validate event will occur when the focus leaves the field. If the validate event occurs, any validation code for the field will be run. This method takes one boolean parameter. Supplying the value true forces the validate event to occur. Supplying the value false clears any previous call to force the validate event to occur.

Hide()
The Hide() method causes the field to become invisible and inaccessible to the user.

Lock()
The Lock() method causes a field to become inaccessible to the user. The fields appearance will not change.

82

P R O G R A M M E R S

G U I D E

C H A P T E R

1 6

W I N D O W

F I E L D S

RunValidate()
The RunValidate() method causes any validation code for the window field to be run.

Show()
The Show() method causes a previously hidden field to become visible and accessible to the user.

Unlock()
The Unlock() method causes a previously locked field to become accessible to the user.

Window field properties


Window fields have the following properties: IsEmpty IsFilled Value

IsEmpty
The IsEmpty property returns the value true when the value of the field is empty for the specific field type. The following table lists the empty value for standard datatypes:
Datatype
Date Currency Integer Long String Time

Empty value
0/0/0 0 0 0 Empty string 000000 which corresponds to 12:00:00 AM

IsFilled
The IsFilled property returns the value true when the value of the field is set to the maximum value for the specific field type. The following table lists the filled value for standard datatypes:
Datatype
Date Currency Integer Long String

Filled value
12/31/9999 99999999999999.99999 32,767 2,147,483,647 The length byte (first byte) of the string is set to the storage size of the string minus 1. Each of the remaining bytes is set to string equivalent of ASCII 255. 23:59:59

Time

Value
The Value property is used to set or retrieve the value of the field. The IntelliSense in Visual Studio will tell you what type of value is used for the field.

PROGRAMMERS

GUIDE

83

PA RT

R E S O U R C E

R E F E R E N C E

Window field events


Window fields provide the following events: Change EnterBeforeOriginal EnterAfterOriginal LeaveBeforeOriginal LeaveAfterOriginal ValidateBeforeOriginal ValidateAfterOriginal

Change
This event occurs when the value of the field changes, such as being set by the user or changed by other code in Microsoft Dynamics GP.

ClickAfterOriginal
This event occurs when the user clicks a button, but after the buttons click event is run.

ClickBeforeOriginal
This event occurs when the user clicks a button, but before the buttons click event is run. This event can be canceled.

EnterBeforeOriginal
This event occurs when the focus moves to the field, but before the fields enter event is run. This event can be canceled.

EnterAfterOriginal
This event occurs when the focus moves to the field, but after the fields enter event is run.

LeaveBeforeOriginal
This event occurs when the focus moves from the field, but before the fields leave event is run. This event can be canceled.

LeaveAfterOriginal
This event occurs when the focus moves from the field, but after the fields leave event is run.

ValidateBeforeOriginal
This event occurs when the focus is to move from the field, and the field has been set to be validated. A field will be validated when its value has been changed, or the validation has been forced, such as with the ForceValidate() method. This event occurs before the fields validate event. It can be canceled.

ValidateAfterOriginal
This event occurs when the focus is to move from the field, and the field has been set to be validated. This event occurs after the fields validate event.

84

P R O G R A M M E R S

G U I D E

Chapter 17:

Tables
Tables are the basic resource of the Microsoft Dynamics GP application that provides access to the database. Methods provided for each table allow creating, retrieving, updating, or deleting rows from the table in the database. The following items for tables are discussed: Accessing tables Table methods Table properties

Accessing tables
A table buffer provides access to one row of a specific table. Your code will interact with the table buffer when you perform operations on the table. There are two types of table buffers: global and form-level.

Global table buffers


A global table buffer is created when a table is accessed directly through the global list of tables. A global table buffer is not shared with any other code. Global table buffers are accessed through the dictionary class. This class has a Tables property that provides access to the collection of tables defined in the dictionary. The dictionary class for the application dictionary is located in the following namespace: Microsoft.Dexterity.Applications For instance, to access the collection of tables in the Dynamics dictionary, use the following syntax: Microsoft.Dexterity.Applications.Dynamics.Tables To access a specific table, such as the RM_Customer_MSTR table (RmCustomerMstr), use the syntax shown below. (This example assumes the namespace mentioned above has been referenced.) Dynamics.Tables.RmCustomerMstr The IntelliSense in Visual Studio will tell you what table in Microsoft Dynamics GP is being referred to by the expression.

Form-level table buffers


A form-level table buffer is created when a table is attached to a form in Microsoft Dynamics GP. There is one table buffer for each table that is attachd to the form. Each form-level table buffer is shared by the code that is part of the form, as well as any code outside of the form that accesses the table through that form. The Tables property for the form allows access to the table buffers for the tables that are attached to the form. For example, to access the form-level procedures for Sales Transaction Entry Form (SopEntryForm) in Microsoft Dynamics GP, you would use the following syntax: Dynamics.Forms.SopEntry.Tables The IntelliSense in Visual Studio will tell you what form-level table in Microsoft Dynamics GP is being referred to by the expression.

PROGRAMMERS

GUIDE

85

PA RT

R E S O U R C E

R E F E R E N C E

Table methods
Tables provide the following methods: Change() ChangeFirst() ChangeLast() ChangePrevious() Clear() Close() Fill() Get() GetFirst() GetLast() GetNext() GetPrevious() RangeClear() RangeEnd() RangeRemove() RangeStart() Release() Remove() Save()

Change()
The Change() method retrieves a row from the table and passively or actively locks the row, allowing changes to be made to it. The row retrieved is determined by the key specified for the table and the values that were specified for the key segments. The Change() method has one parameter: ActiveLock A optional boolean. The value true specifies that an active lock will be applied to the row. The value false (the default value) specifies that a passive lock will be applied.

ChangeFirst()
The ChangeFirst() method retrieves the first row from the table and passively or actively locks the row, allowing changes to be made to it. The row retrieved is determined by the key specified for the table. The ChangeFirst() method has one parameter: ActiveLock A optional boolean. The value true specifies that an active lock will be applied to the row. The value false (the default value) specifies that a passive lock will be applied.

ChangeLast()
The ChangeLast() method retrieves the last row from the table and passively or actively locks the row, allowing changes to be made to it. The row retrieved is determined by the key specified for the table. The ChangeLast() method has one parameter: ActiveLock A optional boolean. The value true specifies that an active lock will be applied to the row. The value false (the default value) specifies that a passive lock will be applied.

86

P R O G R A M M E R S

G U I D E

C H A P T E R

1 7

T A B LE S

ChangeNext()
The ChangeNext() method retrieves the next row from the table and passively or actively locks the row, allowing changes to be made to it. The row retrieved is determined by the key specified for the table and the values of the key fields for the row currently in the table buffer. The ChangeNext() method has one parameter: ActiveLock A optional boolean. The value true specifies that an active lock will be applied to the row. The value false (the default value) specifies that a passive lock will be applied.

ChangePrevious()
The ChangePrevious() method retrieves the previous row from the table and passively or actively locks the row, allowing changes to be made to it. The row retrieved is determined by the key specified for the table and the values of the key fields for the row currently in the table buffer. The ChangePrevious() method has one parameter: ActiveLock A optional boolean. The value true specifies that an active lock will be applied to the row. The value false (the default value) specifies that a passive lock will be applied.

Clear()
The Clear() method sets all of the fields in the table buffer to their cleared values. The following table lists the cleared value for standard datatypes:
Datatype
Date Currency Integer Long String Time

Cleared value
0/0/0 0 0 0 Empty string 000000 which corresponds to 12:00:00 AM

Close()
The Close() method closes the table buffer.

Fill()
The Fill() method sets all of the fields in the table buffer to their maximum values. The following table lists the filled value for standard datatypes:
Datatype
Date Currency Integer Long String

Filled value
12/31/9999 99999999999999.99999 32,767 2,147,483,647 The length byte (first byte) of the string is set to the storage size of the string minus 1. Each of the remaining bytes is set to string equivalent of ASCII 255. 23:59:59

Time

PROGRAMMERS

GUIDE

87

PA RT

R E S O U R C E

R E F E R E N C E

Get()
The Get() method retrieves a row from the table. No lock is applied to the row. The row retrieved is determined by the key specified for the table and the values that were specified for the key segments.

GetFirst()
The GetFirst() method retrieves the first row from the table. No lock is applied to the row. The row retrieved is determined by the key specified for the table.

GetLast()
The GetLast() method retrieves the last row from the table. No lock is applied to the row. The row retrieved is determined by the key specified for the table.

GetNext()
The GetNext() method retrieves the next row from the table. No lock is applied to the row. The row retrieved is determined by the key specified for the table and the values of the key fields for the row currently in the table buffer.

GetPrevious()
The GetPrevious() method retrieves the previous row from the table. No lock is applied to the row. The row retrieved is determined by the key specified for the table and the values of the key fields for the row currently in the table buffer.

RangeClear()
The RangeClear() method removes the range that was specified for the table.

RangeEnd()
The RangeEnd() method specifies the current values of the key segments in the table buffer as the end of the range of rows in the table. The Key property specifies which key will be used for the range.

RangeRemove()
The RangeRemove() method attempts to delete all of the rows in the current range from the table.

RangeStart()
The RangeStart() method specifies the current values of the key segments in the table buffer as the beginning of the range of rows in the table. The Key property specifies which key will be used for the range.

Release()
The Release() method releases any passive or active lock for a row in the table buffer. The row values remain in the table buffer.

Remove()
The Remove() method deletes the current row in the table buffer from the table. The row must be passivly or actively locked before it can be deleted.

Save()
The Save() method saves the values currently in the table buffer to the table. If the row is locked in the table buffer, it will be updated. If no row in the table is locked, a new row will be added.

88

P R O G R A M M E R S

G U I D E

C H A P T E R

1 7

T A B LE S

Table properties
Tables have the following property: Key

Key
The Key property is used to set or retrieve the key currently being used by the table buffer to access the table. The keys for a table are identified by number, beginning with the value 1. When you specify the key you want to use for a table, you will supply the corresponding integer. The Table Descriptions window in Microsoft Dynamics GP lists the keys for each table, and the key segments (fields) that each key contains.

PROGRAMMERS

GUIDE

89

90

P R O G R A M M E R S

G U I D E

Chapter 18:

Table Fields
Table fields represent individual data items in a row of a table. The following items are discussed: Accessing table fields Table field methods Table field properties

Accessing table fields


Table fields for an application dictionary are accessed as properties of the table that they are contained in. For example, the Item Number (ItemNumber) field is available in the Inventory Item Master (IvItemMstr) table. To access it, you would use the following syntax: Dynamics.Tables.IvItemMstr.ItemNumber The IntelliSense in Visual Studio will tell you what field in Microsoft Dynamics GP is being referred to by the expression.

Table field methods


Table fields provide the following methods: Clear() Fill()

Clear()
The Clear() method sets the field to its cleared value. The following table lists the cleared value for standard datatypes:
Datatype
Date Currency Integer Long String Time

Cleared value
0/0/0 0 0 0 Empty string 000000 which corresponds to 12:00:00 AM

Fill()
The Fill() method sets the field to its filled value. The following table lists the filled value for standard datatypes:
Datatype
Date Currency Integer Long String

Filled value
12/31/9999 99999999999999.99999 32,767 2,147,483,647 The length byte (first byte) of the string is set to the storage size of the string minus 1. Each of the remaining bytes is set to string equivalent of ASCII 255. 23:59:59

Time

PROGRAMMERS

GUIDE

91

PA RT

R E S O U R C E

R E F E R E N C E

Table field properties


Table fields have the following properties: IsEmpty IsFilled Value

IsEmpty
The IsEmpty property returns the value true when the value of the field is empty for the specific field type. The following table lists the empty value for standard datatypes:
Datatype
Date Currency Integer Long String Time

Empty value
0/0/0 0 0 0 Empty string 000000 which corresponds to 12:00:00 AM

IsFilled
The IsFilled property returns the value true when the value of the field is set to the maximum value for the specific field type. The following table lists the filled value for standard datatypes:
Datatype
Date Currency Integer Long String

Filled value
12/31/9999 99999999999999.99999 32,767 2,147,483,647 The length byte (first byte) of the string is set to the storage size of the string minus 1. Each of the remaining bytes is set to string equivalent of ASCII 255. 23:59:59

Time

Value
The Value property is used to set or retrieve the value of the field. The IntelliSense in Visual Studio will tell you what type of value is used for the field.

92

P R O G R A M M E R S

G U I D E

Chapter 19:

Commands
In Microsoft Dynamics GP, commands are used to encapsulate a small piece of functionality for the application. They are typically used for navigation. Commands can appear in menus and also in toolbars in Microsoft Dynamics GP. The following items are discussed: Command types Accessing commands Command methods

Command types
A command can be one of the following types: Form A form command opens the specified form. Script A script command runs the script code that is defined for it. Command list A command list command is a container for other commands. A command list can be used as a menu, submenu, or a toolbar.

Accessing commands
Commands for an application dictionary are accessed using the Commands property of the form that they are contained in. Most commands in Microsoft Dynamics GP are contained in forms that are used specifically for commands. The names of these forms begin with Command and include the module for which the commands are used. For example, to access the command used to open the SmartList window in Microsoft Dynamics GP, you would use the following syntax: Dynamics.Forms.CommandSystem.Commands.SmartList The IntelliSense in Visual Studio will tell you what command in Microsoft Dynamics GP is being referred to by the expression.

Command methods
Commands provide the following methods: Check() Disable() Enable() Hide() Run() Show() Uncheck()

Check()
The Check() method causes the command to appear checked if it is displayed in a menu or on a toolbar.

Disable()
The Disable() method causes the command to appear disabled if it is displayed in a menu or on a toolbar. Once disabled, the command cannot be run.

PROGRAMMERS

GUIDE

93

PA RT

R E S O U R C E

R E F E R E N C E

Enable()
The Enable() method causes a previously disabled command to become enabled. It will appear enabled if it is displayed in a menu or on a toolbar.

Hide()
The Hide() method causes a command to be hidden in any menu or toolbar in which it appears. The command can still be run.

Run()
The Run() method performs the action of the command. For form commands, it opens the corresponding form. For script commands, it executes the script code that is attached to the command.

Show()
The Show() method causes a previously hidden command to be displayed in any menu or toolbar in which it appears.

Uncheck()
The Uncheck() method causes the command to appear unchecked if it is displayed in a menu or on a toolbar.

94

P R O G R A M M E R S

G U I D E

Chapter 20:

Globals
Globals are used to hold values accessible to the entire Microsoft Dynamics GP application. The following items are discussed: Accessing globals Global properties

Accessing globals
Globals for an application dictionary are accessed through the dictionary class. This class has a Globals property that provides access to the collection of globals in the dictionary. The dictionary class for the application dictionary is located in the following namespace: Microsoft.Dexterity.Applications For instance, to access the collection of globals in the Dynamics dictionary, use the following syntax: Microsoft.Dexterity.Applications.Dynamics.Globals To access a specific global value, such as the current users ID (UserId), use the following syntax: Microsoft.Dexterity.Applications.Dynamics.Globals.UserId

Global properties
Globals have the following properties available: IsEmpty IsFilled Value

IsEmpty
The IsEmpty property returns the value true when the value of the field is empty for the specific field type. The following table lists the empty value for standard datatypes:
Datatype
Date Currency Integer Long String Time

Empty value
0/0/0 0 0 0 Empty string 000000 which corresponds to 12:00:00 AM

PROGRAMMERS

GUIDE

95

PA RT

R E S O U R C E

R E F E R E N C E

IsFilled
The IsFilled property returns the value true when the value of the field is set to the maximum value for the specific field type. The following table lists the filled value for standard datatypes:
Datatype
Date Currency Integer Long String

Filled value
12/31/9999 99999999999999.99999 32,767 2,147,483,647 The length byte (first byte) of the string is set to the storage size of the string minus 1. Each of the remaining bytes is set to string equivalent of ASCII 255. 23:59:59

Time

Value
The Value property is used to retrieve the value of the global. The IntelliSense in Visual Studio will tell you what type of value is used for the field. Global values cannot be set from a Visual Studio Tools for Microsoft Dynamics GP project.

96

P R O G R A M M E R S

G U I D E

Chapter 21:

Procedures
There are two types of procedures in a Dynamics GP application dictionary. Global procedures are blocks of code that are accessed from various places throughout the application. Parameters are used to send values to a procedure and also to return values from it. Form-level procedures are like global procedures, with the exception that they are defined as part of a specific form. Typically, they perform some action specific to the form they are defined for. The following items are discussed: Accessing global procedures Accessing form-level procedures Procedure methods Invokable procedures

Accessing global procedures


Global procedures for an application dictionary are accessed through the dictionary class. This class has a Procedures property that provides access to the collection of global procedures in the dictionary. The dictionary class for the application dictionary is located in the following namespace: Microsoft.Dexterity.Applications For instance, to access the collection of global procedures in the Dynamics dictionary, use the following syntax: Microsoft.Dexterity.Applications.Dynamics.Procedures To access a specific global procedure, such as the Get_Next_Form_Note_To_Open procedure (GetNextFormNoteToOpen), use the syntax shown below. (This example assumes the namespace mentioned above has been referenced.) Dynamics.Procedures.GetNextFormNoteToOpen The IntelliSense in Visual Studio will tell you what global procedure in Microsoft Dynamics GP is being referred to by the expression.

Accessing form-level procedures


Form-level procedures for an application dictionary are accessed through the form they are contained in. The Procedures property for the form allows access to the form-level procedures. For example, to access the form-level procedures for Sales Transaction Entry Form (SopEntryForm) in Microsoft Dynamics GP, you would use the following syntax: Dynamics.Forms.SopEntry.Procedures The IntelliSense in Visual Studio will tell you what form-level procedure in Microsoft Dynamics GP is being referred to by the expression.

Procedure methods
Procedures provide the following method: Invoke()

PROGRAMMERS

GUIDE

97

PA RT

R E S O U R C E

R E F E R E N C E

Invoke()
The Invoke() method is used to run the specified procedure. The parameters for this method will depend on the procedure that is being run. The following table lists the types of parameters for procedures:
Type
in out inout

Description
Parameters of type in are used only to pass values into the procedure. Parameters of type out are used only to pass values out of the procedure. Parameters of type inout are used to pass values into the procedure, and to pass values out of the procedure.

The IntelliSense in Visual Studio will tell you the type of each parameter for a procedure. It will also tell you the datatype of each parameter, such as decimal or string. For example, the following C# code calls the CheckNoteIdString global procedure. This procedure has one in parameter and two out parameters. Notice that the out keyword is required for the parameters to which values are returned.
Dynamics.Procedures.CheckNoteIdString.Invoke("Estimate Freight", out isPresent, out formNumber);

You can refer to the Microsoft Dynamics GP SDK for details about the procedures available to invoke. Some procedures in Microsoft Dynamics GP have optional parameters defined. Visual Studio Tools does not support optional parameters. You must supply all parameters for a procedure when you invoke it from Visual Studio Tools.

Invokable procedures
With this release of Visual Studio Tools for Microsoft Dynamics GP, not all procedures can be invoked. Procedures with the following characteristics cannot be invoked: The procedure uses table buffers as parameters. Table buffers are a feature of the Dynamics GP runtime engine, and are used when accessing data in the database. The procedure uses anonymous parameters. These parameter types arent known at the time the application is compiled. The procedure uses reference parameters. These parameter types contain a link to a specific resource in the application dictionary. If a composite field used as a procedure parameter contains a reference value, that procedure cannot be invoked.

If a procedure cannot be run by this version of Visual Studio Tools, it will not be included in the procedure lists displayed by the IntelliSense in Visual Studio.

98

P R O G R A M M E R S

G U I D E

Chapter 22:

Functions
There are two types of functions in a Dynamics GP application dictionary. Global functions are blocks of code that are accessed from various places throughout the application. Parameters are used to send values to a function and also to return values from it. In addition, functions always return a value. Form-level functions are like global functions, with the exception that they are defined as part of a specific form. Typically, they perform some action specific to the form they are defined for. The following items are discussed: Accessing global functions Accessing form-level functions Function methods Invokable functions

Accessing global functions


Global functions for an application dictionary are accessed through the dictionary class. This class has a Functions property that provides access to the collection of global functions in the dictionary. The dictionary class for the application dictionary is located in the following namespace: Microsoft.Dexterity.Applications For instance, to access the collection of global functions in the Dynamics dictionary, use the following syntax: Microsoft.Dexterity.Applications.Dynamics.Functions To access a specific global function, such as the GetCurrentDirectory function (GetCurrentDirectory), use the following syntax shown below. (This example assumes the namespace mentioned above has been referenced.) Dynamics.Functions.GetCurrentDirectory The IntelliSense in Visual Studio will tell you what global function in Microsoft Dynamics GP is being referred to by the expression.

Accessing form-level functions


Form-level functions for an application dictionary are accessed through the form they are contained in. The Functions property for the form allows access to the form-level functions. For example, to access the form-level functions for Sales Transaction Entry Form (SopEntryForm) in Microsoft Dynamics GP, you would use the following syntax: Dynamics.Forms.SopEntry.Functions The IntelliSense in Visual Studio will tell you what form-level function in Microsoft Dynamics GP is being referred to by the expression.

PROGRAMMERS

GUIDE

99

PA RT

R E S O U R C E

R E F E R E N C E

Function methods
Functions provide the following method: Invoke()

Invoke()
The Invoke() method is used to run the specified function. The parameters for this method will depend on the procedure that is being run. The following table lists the types of parameters for functions:
Type
in out inout

Description
Parameters of type in are used only to pass values into the function. Parameters of type out are used only to pass values out of the function. Parameters of type inout are used to pass values into the function, and to pass values out of the function.

The Invoke() method will have a return value to which the return value of the function will be returned. The IntelliSense in Visual Studio will tell you the type of each parameter and the return value for a function. It will also tell you the datatype of each parameter and the return value, such as decimal or string. For example, the following C# code calls the GetCurrentDirectory global function. This procedure has no parameters and returns a string value.
string currentDirectory; currentDirectory = Dynamics.Functions.GetCurrentDirectory.Invoke();

You can refer to the Microsoft Dynamics GP SDK for details about the functions available to invoke. Some functions in Microsoft Dynamics GP have optional parameters defined. Visual Studio Tools does not support optional parameters. You must supply all parameters for a function when you invoke it from Visual Studio Tools.

Invokable functions
With this release of Visual Studio Tools for Microsoft Dynamics GP, not all functions can be invoked. Functions with the following characteristics cannot be invoked: The function uses table buffers as parameters. Table buffers are a feature of the Dynamics GP runtime engine, and are used when accessing data in the database. The function uses anonymous parameters. These parameter types arent known at the time the application is compiled. The function uses reference parameters. These parameter types contain a link to a specific resource in the application dictionary. If a composite field used as a function parameter contains a reference value, that function cannot be invoked.

If a function cannot be run by this version of Visual Studio Tools, it will not be included in the function lists displayed by the IntelliSense in Visual Studio.

100

P R O G R A M M E R S

G U I D E

PART 4: INTEGRATION EXAMPLES

Part 4: Integration Examples


This portion of the documentation describes integration examples that show how to use Visual Studio Tools for Microsoft Dynamics GP. The following examples are discussed: Chapter 23, Field Defaulter, describes an example that uses events to default field values in Microsoft Dynamics GP. Chapter 24, Estimate Freight, describes an example that estimates freight amounts for sales documents in Microsoft Dynamics GP.

102

P R O G R A M M E R S

G U I D E

Chapter 23:

Field Defaulter
This sample application demonstrates how events in Microsoft Dynamics GP can be used to default field values. The sample defaults the City and State fields when a user enters a value for the ZIP code field in the Customer Maintenance window. The following topics are discussed: Overview Running the sample application How Visual Studio Tools was used

Overview
This sample application integrates with the Customer Maintenance window in Microsoft Dynamics GP. It automatically defaults values for the City and State fields when the user supplies a known ZIP Code.

The City and State fields are set based on the ZIP Code value entered.

This sample uses a fixed set of ZIP Codes and correspond City and State values. An actual application would use a more extensive set.

Running the sample application


To run this sample application, perform the following steps: 1. Extract the .zip archive containing the samples. In the folder where Visual Studio Tools was installed, locate the Samples.zip archive. This archive contains both the C# and Visual Basic versions of the samples. Extract this archive to a location that you have permissions to access. 2. Open the Field Defaulter sample solution. Using Visual Studio, open the solution file FieldDefaulter.sln for the C# or Visual Basic version of the sample. 3. Verify the references for the sample solution. Use Visual Studio to view the references for the project. The Estimate Freight sample should include references to the following assemblies: Application.Dynamics Microsoft.Dexterity.Bridge

If any of these references for the project are not valid, re-add them to the project. 4. Set the Solution Configuration. Set the Solution Configuration to Release to build the release version of the application.

PROGRAMMERS

GUIDE

103

PA RT

IN T E G R A TI O N

E XA M P LE S

5. Build the application. From the Build menu, choose Build Solution. If there are no build errors, the assembly for the Field Defaulter application will be built. 6. Install the Field Defaulter assembly. Copy the FieldDefaulter.dll from the Release folder for the project to the AddIns folder in the Microsoft Dynamics GP installation. 7. Start Microsoft Dynamics GP . The Field Defaulter sample application will loaded. 8. Open the Customer Maintenance window. In Microsoft Dynamics GP, open the Customer Maintenance window. 9. Enter a ZIP Code. For demonstration purposes, this sample application recognizes only a small number of ZIP codes. You can enter any of the follow ZIP codes and have the corresponding City and State filled in:
02109 53151 55111 56560 58078 58102 58103 58104 58474 60605 85012 95014 98052

When you have finished, close Microsoft Dynamics GP.

How Visual Studio Tools was used


This sample application uses the eventing and resource access features of Visual Studio Tools for Microsoft Dynamics GP.

Resources accessed
The Field Defaulter sample uses the following resources in the Dynamics dictionary:

Forms
RmCustomerMaintenance

Windows
RmCustomerMaintenance

Events
The Field Defaulter sample registers the following event in Microsoft Dynamics GP: A change event for the ZipCode field in the Customer Maintenance window, used to look up the value entered. If the city and state can be found for the ZIP code value entered, their value are automatically set in the window.

104

P R O G R A M M E R S

G U I D E

Chapter 24:

Estimate Freight
This sample application demonstrates several techniques useful when creating Microsoft Dynamics GP integrations. The sample integrates with the Sales Transaction Entry window. The following topics are discussed: Overview Running the sample application How Visual Studio Tools was used

Overview
This sample application integrates with the Sales Transaction Entry window in Microsoft Dynamics GP. It retrieves shipping weight information about the items in the current sales document, calculates an estimated shipping weight for all of the items, and then estimates the freight cost. The estimated freight value is placed into the Freight field of the Sales Transaction Entry window.
The Estimate Freight window estimates freight for the current sales document.

This sample uses a fixed set of shipping methods and shipping rates. An actual application would use a more extensive rate table, and possibly a web service to access freight rates. The Estimate Freight sample uses the table access capabilities of Visual Studio Tools to access data in Microsoft Dynamics GP.

Running the sample application


To run this sample application, perform the following steps: 1. Extract the .zip archive containing the samples. In the folder where Visual Studio Tools was installed, locate the Samples.zip archive. This archive contains both the C# and Visual Basic versions of the samples. Extract this archive to a location that you have permissions to access. 2. Open the Estimate Freight sample solution. Using Visual Studio, open the solution file EstimateFreight.sln for the C# or Visual Basic version of the sample. 3. Verify the references for the sample solution. Use Visual Studio to view the references for the project. The Estimate Freight sample should include references to the following assemblies: Application.Dynamics Microsoft.Dexterity.Bridge Microsoft.Dexterity.Shell

If any of these references for the project are not valid, re-add them to the project.

PROGRAMMERS

GUIDE

105

PA RT

IN T E G R A TI O N

E XA M P LE S

4. Set the Solution Configuration. Set the Solution Configuration to Release to build the release version of the application. 5. Build the application. From the Build menu, choose Build Solution. If there are no build errors, the assembly the for the Estimate Freight application will be built. 6. Install the Estimate Freight assembly. Copy the EstimateFreight.dll from the Release folder for the project to the AddIns folder in the Microsoft Dynamics GP installation. 7. Install the Estimate Freight help file. Copy the EstimateFreight.chm help file from the EstimateFreight folder into the Dynamics GP installation folder. The help file should be placed in the same folder as the GreatPlains.chm help file. 8. Start Microsoft Dynamics GP . The Estimate Freight sample application will loaded. 9. Open the Sales Transaction Entry window. In Microsoft Dynamics GP, open the Sales Transaction Entry window. 10. Display a sales document. You can display an existing sales document or create a new sales document. 11. Add items to the sales document. Be sure the sales document has inventory items for which the estimated shipping weight has been specified. 12. Display the Estimate Freight window. In the Additional menu, choose Estimate Freight. The Estimate Freight window will appear. 13. Choose a shipping method and calculate the freight. Choose either Air or Ground as the shipping method, and then click Calculate to calculate the estimated freight. 14. Return the Freight amount to the sales document. Click Save to return the estimated freight amount to the Freight field for the sales document.

How Visual Studio Tools was used


This sample application uses several features of Visual Studio Tools for Microsoft Dynamics GP to implement this integration.

User interface
The special WinForm available for Dynamics GP add-ins was used when creating the Estimate Freight window. The customized buttons and images were also used. The sample illustrates technique that can be used to implement window-level notes and the online help link.

106

P R O G R A M M E R S

G U I D E

C H A P T E R

2 4

E S T IM AT E

FR EI G HT

Resources accessed
The Estimate Freight sample uses many resources in the Dynamics dictionary:

Forms
SOPEntry FormNote1 FormNote2 FormNote3 FormNote4 FormNote5

Windows
SOPEntry

Global procedures
CheckForNote CheckNoteIdString GetNextFormNoteToOpen

Tables
Data from the following tables is accessed to compute the estimated freight for the current sales document: IvItemMstr (Inventory Item Master) SopLineWork (SOP Line Work)

Events
The Estimate Freight sample registers the following events in Microsoft Dynamics GP: A menu handler event for the Sales Transaction Entry form, used to open the Estimate Freight window. A form close event on the Sales Transaction Entry form, used to indicate when the Sales Transaction Entry window has been closed. A watch event for the SOP Number field in the Sales Transaction Entry window, used to keep the Estimate Freight window updated with the current sales document. An enter event for the Freight field in the Sales Transaction Entry window, used to ask the user whether they want to estimate the freight amount if a value hasnt been supplied. Several form close events for the various Note forms in Microsoft Dynamics GP, used to keep the Note button on the Estimate Freight window updated.

PROGRAMMERS

GUIDE

107

108

P R O G R A M M E R S

G U I D E

Glossary
Active lock
A method of locking that ensures only one user can change or delete the contents of a row at one time. The data in the locked row cant be changed or deleted by another user until the lock is released.

Global variables
A variable available the entire time the Microsoft Dynamics GP application is open. Visual Studio Tools code can read the value of global variables.

Key
A field or combination of fields within a row that is used as the basis by which to store, retrieve, and sort the row in a table.

Alternate forms
Forms from the core Dynamics dictionary that have been changed by a third-party developer, and are stored in a third-party dictionary.

Launch file
A file that is used to start an application with the Dynamics GP runtime engine. This file stores the location of the main application dictionary, the name and location of any forms and reports dictionaries, and the name and location of any integrating dictionaries.

Application assembly
A .NET assembly used by Visual Studio Tools to provide access to the resources in Microsoft Dynamics GP dictionary. Each application dictionary can have one corresponding application assembly.

Local fields
Special fields that are defined for and used only within a specific form in Microsoft Dynamics GP.

Buffer
A temporary storage area in a computers memory. The Microsoft Dynamics GP runtime uses several types of buffers, such as table buffers and window buffers.

Modified forms
Forms in the Microsoft Dynamics GP application that contain modifications made with the Modifier.

Control area
A band drawn at the top of a Microsoft Dynamics GP window. Controls such as Save, Clear, and Delete buttons are placed in the control area.

Passive lock
A method of locking that allows other users to access and make changes to the row.

Product ID
An integer ID that is used to uniquely identify an application dictionary. The Dictionary Assembly Generator refers to dictionaries based on their product ID.

Dictionary Assembly Generator


The tool (DAG.exe) used to build application assemblies for dictionaries.

Dexterity Bridge assembly


The assembly Microsoft.Dexterity.Bridge.dll that provides the access to events in Microsoft Dynamics GP, as well as the resources in the application dictionaries.

Segments
One field of the group of fields that compose a key for a table.

Status area
An area at the bottom of a Microsoft Dynamics GP window created by a divider line drawn across the window. Controls like browse buttons, note buttons, and help buttons are placed in the status area.

Dictionary class
A class used to reference the resources in an application dictionary. The class is available after a reference to the application assembly for a dictionary has been added to the Visual Studio project.

Table buffer
A buffer that acts as an intermediate storage area to hold one row from a table.

Dexterity Shell assembly


The assembly Microsoft.Dexterity.Shell. UI.dll that provides the drawing capabilities that allow an integrating application to match the appearance of Microsoft Dynamics GP

Forms dictionary
The dictionary in a Microsoft Dynamics GP installation that contains the modified forms for an application. Each application dictionary can have a forms dictionary.

Global fields
A type of field that can be used in any form or any table in Microsoft Dynamics GP.

PROGRAMMERS

GUIDE

109

110

P R O G R A M M E R S

G U I D E

Index
A
Accessing Dictionary Resources, chapter 33-36 ActivateAfterOriginal, window event 76 ActivateBeforeOriginal, window event 76 active locks defined 109 described 53 releasing 53 AddIns folder, described 12 Additional menu, adding items to 71 AddMenuHandler(), form method 71 alternate forms accessing with code 66 creating application assembly for 66 defined 109 guidelines for accessing 67 using try...catch with 67 application assemblies creating 29 defined 109 described 12 installing 7 naming convention 29 overriding name 32 references to 33 referencing main application assembly 32 shipped with Visual Studio Tools 12 signing 31 which to use 29 architecture, for Visual Studio Tools 11 assembly information, for integrations 59 AutoSetDexColors control property 25 WinForms property 22

B
background process error, when not closing tables 43 buffers, defined 109 Building and Deploying, chapter 59-61 building integrations 60 buttons field 26 pictures for 26 standard 25 status area 26 toolbar 25 toolbar with separator 26 types of 25 ButtonType property, for button controls 25

C
C# registering events 37 setting assembly information 59

C# (continued) upgrading integrations 15 cancelling events 39 Change, window field event 84 Change(), table method 86 ChangeFirst(), table method 86 ChangeLast(), table method 86 ChangeNext(), table method 87 ChangePrevious(), table method 87 Check(), command method 93 Clear() table field method 91 table method 87 window field method 82 ClickAfterOriginal, window field event 84 ClickBeforeOriginal, window field event 84 Close() form method 73 table method 87 window method 75 CloseAfterOriginal form event 74 window event 76 CloseBeforeOriginal form event 74 window event 76 combo box controls, described 28 command-line, for Dictionary Assembly Generator 30 Commands, form property 73 commands accessing through code 93 chapter 93-94 command list commands 93 form commands 93 methods for 93 resource reference 93 script commands 93 types of 93 components, installed with Visual Studio Tools 9 control area defined 109 described 22 Control Reference, chapter 25-28 ControlArea, WinForms property 22 controls adding to forms 23 buttons 25 combo boxes 28 control reference 25 labels 28 list boxes 28 text boxes 27 conventions, in documentation 3 Customization Status window 64

Debug, solution configuration 60 debugging attaching to a process 63 chapter 63-64 examining application 64 integrations 63 preparations for 63 deleting, rows from tables 47 deploying integrations 61 Developing Integrations, part 20-67 devenv.exe, using to register templates 8 Dexterity Bridge assembly defined 109 described 11 Dexterity Shell assembly defined 109 described 11 Dictionary Assembly Generator application assembly 29 chapter 29-32 commands for 30 creating application assemblies 29 defined 109 described 12, 29 IntelliSense data file 30 launch file used 31 optimizing processing 32 output from 29 using 30 when to use 29 where installed 30 dictionary class defined 109 examples 34 for alternate forms 66 for modified forms 65 resource types to access 34 using to access dictionary resources 34 dictionary resources accessing 33 accessing through dictionary class 34 additional resources 35 list of 70 lists in IntelliSense 34 namespace for accessing 34, 35 variable for 35 working with 70 Disable() command method 93 window field method 82 disabling events 64 Dispose(), form method 73 documentation, symbols and conventions 3 Dynamics.exe, application process when debugging 63

D
DAG.exe, see Dictionary Assembly Generator

E
Enable() command method 94

PROGRAMMERS

GUIDE

111

IN DEX

Enable() (continued) window field method 82 EnterAfterOriginal, window field event 84 EnterBeforeOriginal, window field event 84 errors, for table operations 48 Estimate Freight overview 105 running 105 sample integration 105 use of Visual Studio Tools 106 events cancelling events 39 chapter 37-39 disabling 64 overview 37 registering 37 registering with C# code 37 registering with Visual Basic code 38 responding to 39 exceptions example 67 handling for modified and alternate forms 67

forms dictionaries application assemblies for 29 application assembly for 65 defined 109 generating application assembly for 31 Functions, form property 73 functions chapter 99-100 invokable procedures 100 methods for 100 optional parameters 100 parameter types 100 resource reference 99 return value 100

G
Get(), table method 88 GetFirst(), table method 88 GetLast(), table method 88 GetNext(), table method 88 GetPrevious(), table method 88 Getting Started, part 6-13 global fields, defined 109 global functions accessing through code 99 described 99 global procedures accessing through code 97 described 97 global table buffers accessing 85 described 42, 85 globals accessing through code 95 chapter 95-96 defined 109 properties for 95 resource reference 95

IntelliSense XML files (continued) installing 7 naming convention 30 Invoke() function method 100 procedure method 98 IsEmpty global property 95 table field property 92 window field property 83 IsFilled global property 96 table field property 92 window field property 83 IsOpen form property 73 window property 75

K
Key, table property 89 keys defined 109 for tables 44 segments for 44

F
field, buttons 26 Field Defaulter overview 103 sample integration 103 use of Visual Studio Tools 104 fields global 109 local 109 table fields 91 window fields 81 files, see tables Fill() table field method 91 table method 87 window field method 82 focus, removing from current window 75 Focus(), window field method 82 ForceValidate(), window field method 82 form-level functions accessing through code 99 described 99 form-level procedures accessing through code 97 described 97 form-level table buffers accessing 85 described 42, 85 forms accessing through code 71 chapter 71-74 events for 74 methods for 71 properties for 73 resource reference 71

L
label controls described 28 linked field 28 launch file defined 109 used by Dictionary Assembly Generator 31 LeaveAfterOriginal, window field event 84 LeaveBeforeOriginal, window field event 84 light bulb symbol 3 LineChangeAfterOriginal, scrolling window event 79 LineChangeBeforeOriginal, scrolling window event 79 LineDeleteAfterOriginal, scrolling window event 79 LineDeleteBeforeOriginal, scrolling window event 79 LineEnterAfterOriginal, scrolling window event 78 LineEnterBeforeOriginal, scrolling window event 78 LineFillAfterOriginal, scrolling window event 78 LineFillBeforeOriginal, scrolling window event 77 LineInsertAfterOriginal, scrolling window event 79 LineInsertBeforeOriginal, scrolling window event 79 LineLeaveAfterOriginal, scrolling window event 79

H
Hide() command method 94 window field method 82

I
Initialize() method, for registering events 37 installation chapter 7-10 Visual Studio Tools SDK 7 Integration Basics, chapter 11-13 Integration Examples, part 102-107 integrations building 60 debugging 63 deploying 61 setting assembly information 59 IntelliSense, table information in 42 IntelliSense XML files described 12 generating 30

112

P R O G R A M M E R S

G U I D E

I N D E X

LineLeaveBeforeOriginal, scrolling window event 79 LinkField property, for label controls 28 list box controls, described 28 local fields accessing 81 defined 109 described 81 naming convention for 81 Lock(), window field method 82 locking active locking 53 multiuser scenarios 53 passive locking 53 releasing locks 53 rows 53

optimistic concurrency control, described 53 optimizing, application assembly generation 32

P
parameters, optional parameters 98, 100 passive locks defined 109 described 53 releasing 53 prerequisites, for using Visual Studio Tools for Microsoft Dynamics GP 3 PrintAfterOriginal, window event 76 PrintBeforeOriginal, window event 76 Procedures, form property 73 procedures chapter 97-98 invokable procedures 98 methods for 97 optional parameters 98 parameter types 98 resource reference 97 process, attaching to Dynamics.exe for debugging 63 product ID, defined 109 product support, for Visual Studio Tools for Microsoft Dynamics GP 3 projects adding a Dynamics GP form to 21 creating for Visual Studio Tools 12 PullFocus(), window method 75

M
main dictionary generating application assembly for 31 overriding application assembly name 32 margin notes 3 menus, adding to Additional menu 71 Microsoft Dynamics GP events in 37 tables 41 Microsoft Dynamics GP SDK installing 3 table information in 42 Modified and Alternate Forms, chapter 65-67 modified forms accessing with code 65 creating application assembly for 65 defined 109 guidelines for accessing 67 using try...catch with 67 using with Visual Studio Tools 65 multiuser processing described 53 reading rows 55 removing rows 56 updating rows 55

retrieving rows (continued) multiuser considerations 55 row locking active locking 53 described 53 passive locking 53 releasing locks 53 rows locking 53 removing from tables 47 retrieving from tables 44 saving in tables 45 updating in tables 46 Run(), command method 94 runtime components, for Visual Studio Tools 11 RunValidate(), window field method 83

S
sample integrations Estimate Freight 105 Field Defaulter 103 installing 7 Save(), table method 88 saving, rows in tables 45 scrolling windows accessing current row 78 accessing through code 77 chapter 77-79 described 77 events for 77 preventing rows from displaying 78 resource reference 77 SDK, for Microsoft Dynamics GP 3 segments defined 109 for keys 44 Show() command method 94 window field method 83 signing, application assemblies 31 SN.exe, described 31 solution configuration, for a Visual Studio project 60 standard buttons 25 status area buttons 26 defined 109 described 22 StatusArea, WinForms property 22 strong name key file, described 31 strong names, for application assemblies 31 support, for Visual Studio Tools for Microsoft Dynamics GP 3 symbols in documentation 3

R
RangeClear(), table method 88 RangeEnd(), table method 88 RangeRemove(), table method 88 ranges example 49, 50, 51 for table access 49 multi-segment key 50 removing rows in a range 51 simple key 49 RangeStart(), table method 88 references, to application assemblies 33, 65, 66 registering events 37 registering Visual Studio templates 8 Release, solution configuration 60 Release(), table method 88 releasing locks on table rows 53 Remove(), table method 88 removing rows from tables 47 multiuser considerations 56 Resource Descriptions tool, described 41 Resource Reference, part 70-100 resources, see dictionary resources responding to events 39 retrieving rows from tables 44

N
names, overriding application assembly name 32 namespace, for accessing dictionary resources 34, 35

O
Open() form method 73 window method 75 OpenAfterOriginal form event 74 window event 76 OpenBeforeOriginal form event 74 window event 76

T
table buffers defined 109 described 42, 85

PROGRAMMERS

GUIDE

113

IN DEX

table buffers (continued) form-level 42 global 42 table fields accessing through code 91 chapter 91-92 methods for 91 properties for 92 resource reference 91 table ranges, example 49, 50, 51 Tables, form property 73 tables accessing through code 42, 85 chapter 85-89 closing 43 errors from table operations 48 in Microsoft Dynamics GP 41 keys for 44 learning about 41 methods for 86 multiuser processing 53 opening 43 properties for 89 ranges 49 removing rows 47 resource reference 85 retrieiving rows 44 saving rows 45 updating rows 46 working with 41 technical support, for Visual Studio Tools for Microsoft Dynamics GP 3 templates for Visual Studio 2005 7 for Visual Studio 2008 7 manually registering 8 text box controls 27 third-party applications, application assemblies for 29 toolbar, button type 25 toolbar with separator, button type 26 try...catch, using with modified and alternate forms 67

ValidateBeforeOriginal, window field event 84 Value global property 96 table field property 92 window field property 83 variables, for dictionary resources 35 Visual Basic registering events 38 setting assembly information 60 upgrading integrations 17 Visual Studio upgrading to Visual Studio 2008 9 version required for Visual Studio Tools 3 Visual Studio Tools accessing modified forms 65 architecture 11 capabilities 11 components installed 9 creating user interface 21 development components 12 prerequisites 3 projects, creating 12 runtime components 11 SDK installation 7 technical support 3 whats new 2

W
warning symbol 3 window fields accessing through code 81 chapter 81-84 events for 84 methods for 81 properties for 83 resource reference 81 windows accessing through code 75 chapter 75-76 events for 76 local fields 81 methods for 75 properties for 75 resource reference 75 WinForms adding controls to 23 adding to a project 21 chapter 21-23 properties for 22 Working with Tables, chapter 41-57

U
Uncheck(), command method 94 Unlock(), window field method 83 updating rows in tables 46 multiuser considerations 55 Upgrading an Integration, chapter 15-18 upgrading integrations C# integrations 15 described 15 Visual Basic integrations 17 user interface, for Visual Studio Tools projects 21

X
XML files, for IntelliSense 12

V
ValidateAfterOriginal, window field event 84

114

P R O G R A M M E R S

G U I D E

Vous aimerez peut-être aussi