Compartir a través de


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();

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";