GPUG now in full gear in Chicago

September 15, 2009

The GPUG Summit is now in full gear in Chicago and you can check the first pictures on the Microsoft Dynamics Community Facebook wall.

“Spin the Wheel” chance to win a Convergence 2010 pass and 120GB Zune

Microsoft Dynamics Communities conference booth

Is that Mark Rockwell?

The UnRuly Ladies

The GPUG Summit features a wealth of information-packed Educational Sessions and Role-Based Tracks that deliver Dynamics GP knowledge and experience designed to help organizations optimize the functionality, flexibility, performance and return on investment benefit offered by Dynamics GP.

Be sure to keep up with the Facebook wall or check the live blog at http://www.gpug.com/

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com


Microsoft Dynamics GP Technical Conference 2009 Update

September 8, 2009

It’s official! I will be co-presenting two sessions with no one other than Mr. David Musgrave at the next Microsoft Dynamics GP Technical Conference, to be held in Fargo, North Dakota from November 9 through November 11.

This is my first experience presenting at a Microsoft event and I am sure to have a lot of fun delivering it, but also sharing knowledge and getting to meet a lot of you who are planning to be there. The following is a summary of our sessions:

Session Title: Customizing the Microsoft Dynamics GP Client with Visual Studio Tools, Dexterity and Modifier with VBA
Presenters: David Musgrave, Mariano Gomez
Session Description: Get an in-depth analysis of the various client-side customization tools for Microsoft Dynamics GP, including Modifier with Visual Basic for Applications, Dexterity, and Visual Studio Tools for Microsoft Dynamics GP. This session will help you understand how each of the tools can be used to create user-interface customizations as well as help you develop the ability to make sound decisions on the best tool for a particular purpose.

Session Title: Troubleshooting Your Developed Solution
Presenters: David Musgrave, Mariano Gomez
Session Description: Do you know the vital development considerations necessary for effectively troubleshooting a packaged solution? Learn them and much more! We will highlight best practices, illustrate real-world examples, and provide and discuss requirements for the Certified for Microsoft Dynamics program. Plus, we will show how the Support Debugging Tool for Microsoft Dynamics GP can be used to help with both development and system administration.

Register now for great prices, but don’t forget to review some of the wonderful training classes that will be available before and after the conference event.

Related Articles

Microsoft Dynamics GP Technical Conference 2009 – Click here

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/


Microsoft Dynamics GP Technical Conference 2009

August 18, 2009

The dates are in! Microsoft Dynamics GP Technical Conference 2009 will be hosted in Fargo, North Dakota from November 9 through November 11. The Technical Conference is geared towards Microsoft Dynamics GP developers, implementers, and technical resources in general.

In addition, David Musgrave is working through Microsoft to have me as a co-presenter of two of his sessions. If no arrangements are made, I still will be attending the Conference and the sessions where I expect to meet a good number of you. The sessions being presented by David are as follow:

  • Customizing the Microsoft Dynamics GP Client with Visual Studio Tools, Dexterity and Modifier with VBA. Get an in-depth analysis of the various client-side customization tools for Microsoft Dynamics GP, including Modifier with Visual Basic for Applications, Dexterity, and Visual Studio Tools for Microsoft Dynamics GP. This session will help you understand how each of the tools can be used to create user-interface customizations as well as help you develop the ability to make sound decisions on the best tool for a particular purpose.
  • Troubleshooting Your Developed Solution. Do you know the vital development considerations necessary for effectively troubleshooting a packaged solution? Learn them and much more! David will highlight best practices, illustrate real-world examples, and provide and discuss requirements for the Certified for Microsoft Dynamics program. Plus, he will show how the Support Debugging Tool for Microsoft Dynamics GP can be used to help with both development and system administration.

Hopefully, everything can be sorted out as it will be my honor to co-present with David.

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/


Getting Started with VST: WinForms and Controls – Part 2

August 7, 2009

Well, getting back on track with our series, today I will show you how to add the toolbar and status bar button controls in addition to adding the code that will allow our WinForm to be displayed as an menu option under the Additional menu on the Customer Maintenance window.

1) In the Toolbox window, choose Button

2) Click on the toolbar area of the window to place the button control. Then change the properties as indicated in the picture below:

Note that the ButtonType on dexButtonProvider property is implemented as part of the Microsoft Dexterity Shell assembly (Microsoft.Dexterity.Shell.dll). Also, note that when I set the value to ToolbarWithSeparator the button immediately acquired the “look and field” of a typical Dexterity toolbar button.

3) Now, let’s add the image to the Ok button. To do this, we can click on the image property and select the picture resource that best suit our needs:

In this case, I selected the Toolbar_Post image in the Resources file. Now, you can choose to add the actual checkmark image as part of the existing resources, but that is not a topic of this article.

4) On your own, add the window help button and the window note present and window note absent buttons to the status bar. For these controls, you will want to change the ButtonType on dexButtonProvider property to StatusArea and remove clear the text in the Text property. Don’t forget to stack the the note buttons! The final result should look like the picture below:

5) Now that we have finalized the window layout, let’s add some code to create the equivalent of a Dexterity form trigger. This will create an Additional menu on the Customer Maintenance window, allowing us to open the form. In VST, Dexterity form triggers are known as Menu Handler events and need to be registered in the Initialize() method in the GPAddIn.cs class.

GPAddIn.cs

using System;using System.Collections.Generic;using System.Text;using Microsoft.Dexterity.Bridge;using Microsoft.Dexterity.Applications;using Microsoft.Dexterity.Applications.DynamicsDictionary;

namespace GPWinForm{    public class GPAddIn : IDexterityAddIn    {        // Add a variable reference to the RM Customer Maintenance form        static RmCustomerMaintenanceForm CustomerMaintenanceForm = Dynamics.Forms.RmCustomerMaintenance;

        // Keep a reference to the rmCustomerHobbies WinForm        static rmCustomerHobbies rmCustomerHobbiesForm;

        public void Initialize()        {            CustomerMaintenanceForm.AddMenuHandler(OpenRMCustomerHobbies, "Customer Hobbies", "H");        }

        static void OpenRMCustomerHobbies(object Sender, EventArgs e)        {            // check to make sure the form is not either empty or already created            if (rmCustomerHobbiesForm == null)                rmCustomerHobbiesForm = new rmCustomerHobbies();            else                if (rmCustomerHobbiesForm.Created == false)                    rmCustomerHobbiesForm = new rmCustomerHobbies();

            rmCustomerHobbiesForm.Show();            rmCustomerHobbiesForm.Activate();

        }    }}

A couple things to note. In this script, we added static references to the Customer Maintenance form and rmCustomerHobbies WinForm to facilitate interacting with these throughout our code:

// Add a variable reference to the RM Customer Maintenance formstatic RmCustomerMaintenanceForm CustomerMaintenanceForm = Dynamics.Forms.RmCustomerMaintenance;

// Keep a reference to the rmCustomerHobbies WinFormstatic rmCustomerHobbies rmCustomerHobbiesForm;

We also added the menu handler event to assist in displaying a menu option to call our WinForm from the Customer Maintenance window. The OpenRMCustomerHobbies event handler method is the equivalent of a trigger processing procedure in Dexterity:

CustomerMaintenanceForm.AddMenuHandler(OpenRMCustomerHobbies, "Customer Hobbies", "H");

In Dexterity, the open form statement does a few things: it opens the form, activates the form, and open the main window of that form, if the AutoOpen property of the window is set to True . In VST, we can accomplish the same in two steps, by invoking the Show() and Activate() class methods of the form object.

rmCustomerHobbiesForm.Show();rmCustomerHobbiesForm.Activate();

With the instructions provided in Part 1 of the WinForms and Controls series, we can proceed to build and deploy our assembly (I did not change the assembly name for this project). Once you load GP, open the Customer Maintenance window (Cards > Sales > Customer) to test the solution. You should now see the Additional menu option, along with our Customer Hobbies entry.


If you select the option, you should now see our form. Granted, we haven’t added any code to manage whether a record was selected or not prior to our form being opened, we did not add any code to preset the Customer ID and Customer Name fields on our WinForm based on the same field values on the Customer Maintenance window, and certainly have not added any code to retrieve or store data based on the selected customer. All this will be a part of our next article.

Downloads

GPWinForm solution – C# – Click here

Related Articles

Getting Started with VST: WinForms and Controls – Part 1
Getting started with VST: “Hello World!” – The Video
Getting started with VST: “Hello World!” project
Getting started with Visual Studio Tools for Microsoft Dynamics GP — Adventures of a Microsoft Dexterity developer

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/


Getting Started with VST: WinForms and Controls – Part 2

August 7, 2009

Well, getting back on track with our series, today I will show you how to add the toolbar and status bar button controls in addition to adding the code that will allow our WinForm to be displayed as an menu option under the Additional menu on the Customer Maintenance window.

1) In the Toolbox window, choose Button

2) Click on the toolbar area of the window to place the button control. Then change the properties as indicated in the picture below:

Note that the ButtonType on dexButtonProvider property is implemented as part of the Microsoft Dexterity Shell assembly (Microsoft.Dexterity.Shell.dll). Also, note that when I set the value to ToolbarWithSeparator the button immediately acquired the “look and field” of a typical Dexterity toolbar button.

3) Now, let’s add the image to the Ok button. To do this, we can click on the image property and select the picture resource that best suit our needs:

In this case, I selected the Toolbar_Post image in the Resources file. Now, you can choose to add the actual checkmark image as part of the existing resources, but that is not a topic of this article.

4) On your own, add the window help button and the window note present and window note absent buttons to the status bar. For these controls, you will want to change the ButtonType on dexButtonProvider property to StatusArea and remove clear the text in the Text property. Don’t forget to stack the the note buttons! The final result should look like the picture below:

5) Now that we have finalized the window layout, let’s add some code to create the equivalent of a Dexterity form trigger. This will create an Additional menu on the Customer Maintenance window, allowing us to open the form. In VST, Dexterity form triggers are known as Menu Handler events and need to be registered in the Initialize() method in the GPAddIn.cs class.

GPAddIn.cs

using System;using System.Collections.Generic;using System.Text;using Microsoft.Dexterity.Bridge;using Microsoft.Dexterity.Applications;using Microsoft.Dexterity.Applications.DynamicsDictionary;

namespace GPWinForm{    public class GPAddIn : IDexterityAddIn    {        // Add a variable reference to the RM Customer Maintenance form        static RmCustomerMaintenanceForm CustomerMaintenanceForm = Dynamics.Forms.RmCustomerMaintenance;

        // Keep a reference to the rmCustomerHobbies WinForm        static rmCustomerHobbies rmCustomerHobbiesForm;

        public void Initialize()        {            CustomerMaintenanceForm.AddMenuHandler(OpenRMCustomerHobbies, "Customer Hobbies", "H");        }

        static void OpenRMCustomerHobbies(object Sender, EventArgs e)        {            // check to make sure the form is not either empty or already created            if (rmCustomerHobbiesForm == null)                rmCustomerHobbiesForm = new rmCustomerHobbies();            else                if (rmCustomerHobbiesForm.Created == false)                    rmCustomerHobbiesForm = new rmCustomerHobbies();

            rmCustomerHobbiesForm.Show();            rmCustomerHobbiesForm.Activate();

        }    }}

A couple things to note. In this script, we added static references to the Customer Maintenance form and rmCustomerHobbies WinForm to facilitate interacting with these throughout our code:

// Add a variable reference to the RM Customer Maintenance formstatic RmCustomerMaintenanceForm CustomerMaintenanceForm = Dynamics.Forms.RmCustomerMaintenance;

// Keep a reference to the rmCustomerHobbies WinFormstatic rmCustomerHobbies rmCustomerHobbiesForm;

We also added the menu handler event to assist in displaying a menu option to call our WinForm from the Customer Maintenance window. The OpenRMCustomerHobbies event handler method is the equivalent of a trigger processing procedure in Dexterity:

CustomerMaintenanceForm.AddMenuHandler(OpenRMCustomerHobbies, "Customer Hobbies", "H");

In Dexterity, the open form statement does a few things: it opens the form, activates the form, and open the main window of that form, if the AutoOpen property of the window is set to True . In VST, we can accomplish the same in two steps, by invoking the Show() and Activate() class methods of the form object.

rmCustomerHobbiesForm.Show();rmCustomerHobbiesForm.Activate();

With the instructions provided in Part 1 of the WinForms and Controls series, we can proceed to build and deploy our assembly (I did not change the assembly name for this project). Once you load GP, open the Customer Maintenance window (Cards > Sales > Customer) to test the solution. You should now see the Additional menu option, along with our Customer Hobbies entry.


If you select the option, you should now see our form. Granted, we haven’t added any code to manage whether a record was selected or not prior to our form being opened, we did not add any code to preset the Customer ID and Customer Name fields on our WinForm based on the same field values on the Customer Maintenance window, and certainly have not added any code to retrieve or store data based on the selected customer. All this will be a part of our next article.

Downloads

GPWinForm solution – C# – Click here

Related Articles

Getting Started with VST: WinForms and Controls – Part 1
Getting started with VST: “Hello World!” – The Video
Getting started with VST: “Hello World!” project
Getting started with Visual Studio Tools for Microsoft Dynamics GP — Adventures of a Microsoft Dexterity developer

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/


Getting Started with VST: WinForms and Controls – Part 1

July 31, 2009

If you have been around Microsoft Dexterity long enough, by now you are already aware that Dex is not an object oriented development environment, and rather supports a concept called object-based development. In the traditional sense, Dexterity does not allow you to define classes and derive objects from those classes. However, someone figured out that a Dexterity form can act as a container or class, with the Scripts and Functions tabs allowing you to define the contructors, destructors and methods for the class. In addition, adding fields to a window and setting the proper values for those fields allows developers to set the state of an object. Given the nature of the form and how the scripts on that form are called, and the values for fields on windows are set, forms can simulate classes with public and private methods in traditional object oriented programming terms.

Thank goodness, you don’t need to do all this in Visual Studio! VST allows you to define a WinForm, or in simple terms, a Windows Form. Forms in VST cannot be grouped as you would normally do in Dexterity, so in that sense, they behave like typical Dexterity window, but they still provide all the functionality, including the look and feel due to the inherited properties created with the Dexterity Bridge assembly.

Customer Hobbies WinForm

Our example today, will show how to add the equivalent of a Dexterity form trigger, known in VST as a menu handler event. Typically, form triggers add an entry to the Additional menu on a Dexterity form. Today, we will add a Customer Hobbies form and will then add a menu handler event to the Customer Maintenance form to call our form.

1) Open Visual Studio. Go to File > New > Project to create a new Visual Studio project.

2) Find the Dynamics GP in the Project Types pane, then choose Microsoft Dynamics GP Add-In from the installed templates pane.

3) Enter a name for the project. We will be naming our project GPWinForm.

4) Click OK to continue

5) Make sure your GPAddIn.cs code looks like this:

GPAddIn.cs

using System;using System.Collections.Generic;using System.Text;using Microsoft.Dexterity.Bridge;using Microsoft.Dexterity.Applications;using Microsoft.Dexterity.Applications.DynamicsDictionary;

namespace GPWinForm{    public class GPAddIn : IDexterityAddIn    {        // IDexterityAddIn interface

        public void Initialize()        {

        }    }}

6) We will first define our WinForm. In Solution Explorer, right-click on the project name and navigate to Add > New Item as shown in the figure below.

7) In the Add New Item window we will highlight Microsoft Dynamics GP Form and name our form rmCustomerHobbies.cs. Click on Add to continue.

8) Here comes VST into play! When the form is defined, you will notice a set of providers at the bottom of the design window, as shown below.

These providers allow WinForms and certain controls to inherit properties unique to Dexterity windows and controls. In the example, our WinForm is given a Control area and a Status area by default. To change the window title, locate the Text property in the Properties window and edit to Customer Hobbies.

9) Now, let’s add some controls — you will need to resize your window accordingly. We will add a few prompts (known as labels in Visual Studio) and a few strings (known as text boxes in Visual Studio). First our text boxes:

a) Click on the TextBox control in the Toolbox. We will add the CustomerNumber field. Set the properties for the field as follow:


b) Now, let’s add the CustomerName field. We can follow the same steps used in (a). At the end your window should look like this:


In traditional Dexterity style, these two fields will inherit the values displayed in the Customer Maintenance window when a record is selected and the Customer Hobbies window is selected.

10) Now we can add the labels that will identify our fields when the window is opened. We will add the Customer ID and Customer Name labels, but most importantly, show how you can link fields to their prompts as well, just like in Dexterity.

a) Click on the Label control in the Toolbox. Now place the label in from of the CustomerNumber field. Size the label accordingly and align accordingly. Set the label properties as follow:

NOTE: Unlike Dexterity, label controls are referenciable via code, hence the Name property of the control.

b) Repeat step (a) for the Customer Name label and set the propeties as well.


11) Now let’s proceed to link the fields to their prompts. One of the properties unique to VST label controls is the LinkField on dexLabelProvider. This property will display a drop-down list that will allow you to select the corresponding window field for the label, as shown below:


Once a label is linked to a textbox, you will see the traditional underline that accompanies all Dexterity prompts.

12) Following the same guidelines, we will add 4 more text boxes, rmCustomerSports, rmCustomerSportsTeam, rmCustomerLeisureActivity, and rmCustomerRestaurant, and the corresponding labels to indicate the customer’s hobbies. Note that the Enabled property for these new controls must be set to True to allow the controls to receive data. We will also use an empty label from the Toolbox to create the separator between the window’s static section and the data entry section, a la Dexterity. Your final window should look like this — don’t worry if you did not get the same results, I have uploaded the solution for your benefit.


Part 2 of the “WinForms and Controls” series will discuss adding the typical buttons to the screen, like the Ok button, the window help button and the window notes buttons. In addition to the code needed to produce the menu handler event.

Downloads

GPWinForm Solution – click here.

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/

Updates to this article
08/07/2009 – Fixed broken link to solution download.


Getting Started with VST: WinForms and Controls – Part 1

July 31, 2009

If you have been around Microsoft Dexterity long enough, by now you are already aware that Dex is not an object oriented development environment, and rather supports a concept called object-based development. In the traditional sense, Dexterity does not allow you to define classes and derive objects from those classes. However, someone figured out that a Dexterity form can act as a container or class, with the Scripts and Functions tabs allowing you to define the contructors, destructors and methods for the class. In addition, adding fields to a window and setting the proper values for those fields allows developers to set the state of an object. Given the nature of the form and how the scripts on that form are called, and the values for fields on windows are set, forms can simulate classes with public and private methods in traditional object oriented programming terms.

Thank goodness, you don’t need to do all this in Visual Studio! VST allows you to define a WinForm, or in simple terms, a Windows Form. Forms in VST cannot be grouped as you would normally do in Dexterity, so in that sense, they behave like typical Dexterity window, but they still provide all the functionality, including the look and feel due to the inherited properties created with the Dexterity Bridge assembly.

Customer Hobbies WinForm

Our example today, will show how to add the equivalent of a Dexterity form trigger, known in VST as a menu handler event. Typically, form triggers add an entry to the Additional menu on a Dexterity form. Today, we will add a Customer Hobbies form and will then add a menu handler event to the Customer Maintenance form to call our form.

1) Open Visual Studio. Go to File > New > Project to create a new Visual Studio project.

2) Find the Dynamics GP in the Project Types pane, then choose Microsoft Dynamics GP Add-In from the installed templates pane.

3) Enter a name for the project. We will be naming our project GPWinForm.

4) Click OK to continue

5) Make sure your GPAddIn.cs code looks like this:

GPAddIn.cs

using System;using System.Collections.Generic;using System.Text;using Microsoft.Dexterity.Bridge;using Microsoft.Dexterity.Applications;using Microsoft.Dexterity.Applications.DynamicsDictionary;

namespace GPWinForm{    public class GPAddIn : IDexterityAddIn    {        // IDexterityAddIn interface

        public void Initialize()        {

        }    }}

6) We will first define our WinForm. In Solution Explorer, right-click on the project name and navigate to Add > New Item as shown in the figure below.

7) In the Add New Item window we will highlight Microsoft Dynamics GP Form and name our form rmCustomerHobbies.cs. Click on Add to continue.

8) Here comes VST into play! When the form is defined, you will notice a set of providers at the bottom of the design window, as shown below.

These providers allow WinForms and certain controls to inherit properties unique to Dexterity windows and controls. In the example, our WinForm is given a Control area and a Status area by default. To change the window title, locate the Text property in the Properties window and edit to Customer Hobbies.

9) Now, let’s add some controls — you will need to resize your window accordingly. We will add a few prompts (known as labels in Visual Studio) and a few strings (known as text boxes in Visual Studio). First our text boxes:

a) Click on the TextBox control in the Toolbox. We will add the CustomerNumber field. Set the properties for the field as follow:


b) Now, let’s add the CustomerName field. We can follow the same steps used in (a). At the end your window should look like this:


In traditional Dexterity style, these two fields will inherit the values displayed in the Customer Maintenance window when a record is selected and the Customer Hobbies window is selected.

10) Now we can add the labels that will identify our fields when the window is opened. We will add the Customer ID and Customer Name labels, but most importantly, show how you can link fields to their prompts as well, just like in Dexterity.

a) Click on the Label control in the Toolbox. Now place the label in from of the CustomerNumber field. Size the label accordingly and align accordingly. Set the label properties as follow:

NOTE: Unlike Dexterity, label controls are referenciable via code, hence the Name property of the control.

b) Repeat step (a) for the Customer Name label and set the propeties as well.


11) Now let’s proceed to link the fields to their prompts. One of the properties unique to VST label controls is the LinkField on dexLabelProvider. This property will display a drop-down list that will allow you to select the corresponding window field for the label, as shown below:


Once a label is linked to a textbox, you will see the traditional underline that accompanies all Dexterity prompts.

12) Following the same guidelines, we will add 4 more text boxes, rmCustomerSports, rmCustomerSportsTeam, rmCustomerLeisureActivity, and rmCustomerRestaurant, and the corresponding labels to indicate the customer’s hobbies. Note that the Enabled property for these new controls must be set to True to allow the controls to receive data. We will also use an empty label from the Toolbox to create the separator between the window’s static section and the data entry section, a la Dexterity. Your final window should look like this — don’t worry if you did not get the same results, I have uploaded the solution for your benefit.


Part 2 of the “WinForms and Controls” series will discuss adding the typical buttons to the screen, like the Ok button, the window help button and the window notes buttons. In addition to the code needed to produce the menu handler event.

Downloads

GPWinForm Solution – click here.

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/

Updates to this article
08/07/2009 – Fixed broken link to solution download.


Getting started with VST: "Hello World!" – The Video

July 24, 2009

Getting started with VST: "Hello World!" project

July 21, 2009

Adventures of a Microsoft Dexterity Developer

Okay, so we did not get this far to bring up a “Hello World” message, but I figured that’s a pretty standard thing to do in the software development world to introduce a tool or language to software developers, so I am not going to pass upon the chance!

Creating our first Visual Studio Tools project… with a twist!

For this project, we want to be able to register two events that will allow us to display the messages “Getting ready to say Hello World!” and “Hello World” messages after login is successful and before and after the Toolbar form is loaded. Usually, this method of trigger registration is used by Dexterity developers to run code after log in, so I figured I would replicate something we are most familiar with.

Topics being covered

  • Creating a VST project
  • Events registration
  • Running your code before and after login
  • Building and Deploying VST project

Let’s get started!

1) Open Visual Studio. Go to File > New > Project to create a new Visual Studio project.

2) Find the Dynamics GP in the Project Types pane, then choose Microsoft Dynamics GP Add-In from the installed templates pane.

3) Enter a name for the project. We will be naming our project GPHelloWorld.

4) Click OK to continue.


NOTE: As indicated, I will be using C# as my development language, however, the steps to initiate the project for VB.NET should be the same.

5) Upon clicking OK, Visual Studio will proceed to initialize our project for us. The first thing you will see is the Initialize() method in the GPAddIn class. The GPAddIn is an implementation of the IDexterityAddIn interface. Sufficient to say, the Initialize() method is equivalent to the global Startup script in a Dexterity integrating application, serving as entry point to the add-in project.

GPAddIn.cs

using System;using System.Collections.Generic;using System.Text;using Microsoft.Dexterity.Bridge;using Microsoft.Dexterity.Applications;

namespace GPHelloWorld{    public class GPAddIn : IDexterityAddIn    {        // IDexterityAddIn interface        public void Initialize()        {

        }    }}

NOTE the Solution Explorer window will show the references to the primary assembly responsible for exposing Dynamics GP resources: the Microsoft.Dexterity.Bridge assembly. As well, you can find all picture resources that will make our VST controls look awefully similar to the standard controls available to integrating Dexterity applications.

6) Now, we will proceed to register the event on the Toolbar form. We will display a message “Getting ready to say Hello World!” before the toolbar form is loaded and one that says “Hello World!” after the toolbar is loaded. You can then decide what event works best for your individual needs.

GPAddIn.cs

using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using Microsoft.Dexterity.Bridge;using Microsoft.Dexterity.Applications;using Microsoft.Dexterity.Applications.DynamicsDictionary;

namespace GPHelloWorld{    public class GPAddIn : IDexterityAddIn    {        // IDexterityAddIn interface        public void Initialize()        {            ToolbarForm toolbar;            toolbar = Dynamics.Forms.Toolbar;

            // add registration before the form open event            toolbar.OpenBeforeOriginal += new System.ComponentModel.CancelEventHandler(toolbar_OpenBeforeOriginal);

            // add registration after the form open event            toolbar.OpenAfterOriginal += new EventHandler(toolbar_OpenAfterOriginal);        }

        void toolbar_OpenBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)        {            MessageBox.Show("Getting ready to say Hello World!");        }

        void toolbar_OpenAfterOriginal(object sender, EventArgs e)        {            MessageBox.Show("Hello World!");

        }    }}

A couple things to highlight in the code:

a) Like references in Dexterity, VST allows you to create variables that point to specific dictionary resources. The definitions for the various dictionary resources are found in an additional namespace available in the application assembly, Microsoft.Dexterity.Applications.DynamicsDictionary.

using Microsoft.Dexterity.Applications.DynamicsDictionary;

Once the namespace is added, you can then proceed to declare a variable that will represent the Toolbar form.

public void Initialize(){    ToolbarForm toolbar;    toolbar = Dynamics.Forms.Toolbar;    .    .}

b) An event registration is the Visual Studio equivalent of a Dexterity trigger. As such, they must be included in the Initialize() method, added automatically when the project was created. The Initialize() method is the equivalent of the Startup() script in a Dexterity integrating application. To register the events that will be executed before and after the Toolbar form is loaded, the following code was added,

// add registration before the form open eventtoolbar.OpenBeforeOriginal += new System.ComponentModel.CancelEventHandler(toolbar_OpenBeforeOriginal);

// add registration after the form open eventtoolbar.OpenAfterOriginal += new EventHandler(toolbar_OpenAfterOriginal);

If you noticed when you typed the += character sequence, you were prompted to press the TAB key twice! Intellisense automatically completed the code and added the overload methods for each event handler. Now, that’s a time saver! Imagine if we had this type of capability when adding the trigger registration scripts in Dexterity!

c) The rest was just cosmetics.. I added the MessageBox.Show() function to display our two messages in each overload method. The MessageBox is part of the System.Windows.Forms namespace which must be added to the using section of the application.

void toolbar_OpenBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)

{   MessageBox.Show("Getting ready to say Hello World!");}

void toolbar_OpenAfterOriginal(object sender, EventArgs e){   MessageBox.Show("Hello World!");}

Simple enough!

7) Building the solution is done via the Build menu, but before, we can set our final assembly name by right-clicking on the GPHelloWorld project in the Solution Explorer window and selecting the Properties option.

8) Build the solution. You should be able to find your new assembly in the Bin\Debug folder of the solution directory, typically under C:\Users\yourUser\Documents\Visual Studio 2008\Projects\GPHelloWorld\GPHelloWorld\bin\Debug.

Copy the resulting project assembly to the AddIns folder under your Microsoft Dynamics GP installation directory.

Testing the solution

Open Microsoft Dynamics GP to see the results. Before the Toolbar form is loaded, we will receive the first message:

Once the Toolbar form is loaded, our next message will be displayed, as follows:


I guess this is not bad for a first try, is it?

While integrating solutions tend to be a lot more complex than our Hello World application, the principles will be the same. For our next installment, I will be contructing a WinForm and showing common ways to store and retrieve data in a VST solution.

Downloads

HelloWorld Solution C# – Click here
HelloWorld Solution VB.NET – Click here

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/


Getting started with VST: "Hello World!" project

July 21, 2009

Adventures of a Microsoft Dexterity Developer

Okay, so we did not get this far to bring up a “Hello World” message, but I figured that’s a pretty standard thing to do in the software development world to introduce a tool or language to software developers, so I am not going to pass upon the chance!

Creating our first Visual Studio Tools project… with a twist!

For this project, we want to be able to register two events that will allow us to display the messages “Getting ready to say Hello World!” and “Hello World” messages after login is successful and before and after the Toolbar form is loaded. Usually, this method of trigger registration is used by Dexterity developers to run code after log in, so I figured I would replicate something we are most familiar with.

Topics being covered

  • Creating a VST project
  • Events registration
  • Running your code before and after login
  • Building and Deploying VST project

Let’s get started!

1) Open Visual Studio. Go to File > New > Project to create a new Visual Studio project.

2) Find the Dynamics GP in the Project Types pane, then choose Microsoft Dynamics GP Add-In from the installed templates pane.

3) Enter a name for the project. We will be naming our project GPHelloWorld.

4) Click OK to continue.


NOTE: As indicated, I will be using C# as my development language, however, the steps to initiate the project for VB.NET should be the same.

5) Upon clicking OK, Visual Studio will proceed to initialize our project for us. The first thing you will see is the Initialize() method in the GPAddIn class. The GPAddIn is an implementation of the IDexterityAddIn interface. Sufficient to say, the Initialize() method is equivalent to the global Startup script in a Dexterity integrating application, serving as entry point to the add-in project.

GPAddIn.cs

using System;using System.Collections.Generic;using System.Text;using Microsoft.Dexterity.Bridge;using Microsoft.Dexterity.Applications;

namespace GPHelloWorld{    public class GPAddIn : IDexterityAddIn    {        // IDexterityAddIn interface        public void Initialize()        {

        }    }}

NOTE the Solution Explorer window will show the references to the primary assembly responsible for exposing Dynamics GP resources: the Microsoft.Dexterity.Bridge assembly. As well, you can find all picture resources that will make our VST controls look awefully similar to the standard controls available to integrating Dexterity applications.

6) Now, we will proceed to register the event on the Toolbar form. We will display a message “Getting ready to say Hello World!” before the toolbar form is loaded and one that says “Hello World!” after the toolbar is loaded. You can then decide what event works best for your individual needs.

GPAddIn.cs

using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;using Microsoft.Dexterity.Bridge;using Microsoft.Dexterity.Applications;using Microsoft.Dexterity.Applications.DynamicsDictionary;

namespace GPHelloWorld{    public class GPAddIn : IDexterityAddIn    {        // IDexterityAddIn interface        public void Initialize()        {            ToolbarForm toolbar;            toolbar = Dynamics.Forms.Toolbar;

            // add registration before the form open event            toolbar.OpenBeforeOriginal += new System.ComponentModel.CancelEventHandler(toolbar_OpenBeforeOriginal);

            // add registration after the form open event            toolbar.OpenAfterOriginal += new EventHandler(toolbar_OpenAfterOriginal);        }

        void toolbar_OpenBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)        {            MessageBox.Show("Getting ready to say Hello World!");        }

        void toolbar_OpenAfterOriginal(object sender, EventArgs e)        {            MessageBox.Show("Hello World!");

        }    }}

A couple things to highlight in the code:

a) Like references in Dexterity, VST allows you to create variables that point to specific dictionary resources. The definitions for the various dictionary resources are found in an additional namespace available in the application assembly, Microsoft.Dexterity.Applications.DynamicsDictionary.

using Microsoft.Dexterity.Applications.DynamicsDictionary;

Once the namespace is added, you can then proceed to declare a variable that will represent the Toolbar form.

public void Initialize(){    ToolbarForm toolbar;    toolbar = Dynamics.Forms.Toolbar;    .    .}

b) An event registration is the Visual Studio equivalent of a Dexterity trigger. As such, they must be included in the Initialize() method, added automatically when the project was created. The Initialize() method is the equivalent of the Startup() script in a Dexterity integrating application. To register the events that will be executed before and after the Toolbar form is loaded, the following code was added,

// add registration before the form open eventtoolbar.OpenBeforeOriginal += new System.ComponentModel.CancelEventHandler(toolbar_OpenBeforeOriginal);

// add registration after the form open eventtoolbar.OpenAfterOriginal += new EventHandler(toolbar_OpenAfterOriginal);

If you noticed when you typed the += character sequence, you were prompted to press the TAB key twice! Intellisense automatically completed the code and added the overload methods for each event handler. Now, that’s a time saver! Imagine if we had this type of capability when adding the trigger registration scripts in Dexterity!

c) The rest was just cosmetics.. I added the MessageBox.Show() function to display our two messages in each overload method. The MessageBox is part of the System.Windows.Forms namespace which must be added to the using section of the application.

void toolbar_OpenBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)

{   MessageBox.Show("Getting ready to say Hello World!");}

void toolbar_OpenAfterOriginal(object sender, EventArgs e){   MessageBox.Show("Hello World!");}

Simple enough!

7) Building the solution is done via the Build menu, but before, we can set our final assembly name by right-clicking on the GPHelloWorld project in the Solution Explorer window and selecting the Properties option.

8) Build the solution. You should be able to find your new assembly in the Bin\Debug folder of the solution directory, typically under C:\Users\yourUser\Documents\Visual Studio 2008\Projects\GPHelloWorld\GPHelloWorld\bin\Debug.

Copy the resulting project assembly to the AddIns folder under your Microsoft Dynamics GP installation directory.

Testing the solution

Open Microsoft Dynamics GP to see the results. Before the Toolbar form is loaded, we will receive the first message:

Once the Toolbar form is loaded, our next message will be displayed, as follows:


I guess this is not bad for a first try, is it?

While integrating solutions tend to be a lot more complex than our Hello World application, the principles will be the same. For our next installment, I will be contructing a WinForm and showing common ways to store and retrieve data in a VST solution.

Downloads

HelloWorld Solution C# – Click here
HelloWorld Solution VB.NET – Click here

Until next post!

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/