Customising the Company Login window series – Visual Studio Tools revisited – Visual C#

David Meego - Click for blog homepageJust before I left Microsoft, I was writing a series of blog articles about Customising the Company Login window so that you could see the full company name in the drop down list for long company names.

I had shown how to achieve the customisation with Dexterity and with Visual Basic for Applications, but was having problems getting it to work from Visual Studio Tools.

The problem was that Visual Studio Tools does not have the properties and methods to get and set the sizes of the fields. So the solution was to access the Continuum library to execute pass through Dexterity sanScript instead. My original article is below:

In the article, I explained how I was unable to get the references working to allow me to call the Continuum library. In the end, I ran out of time before I left Microsoft and so I issued a challenge to the community to take my idea and make it work.

Well, Tim Wappat from the Dynamic Coding Blocks blog, took up my challenge and was able to complete the customisation. He explains how he got it working in the following article:

Based on Tim’s article and had another go at making this work and below the steps I used for Visual C#:

  1. Ensure Visual Studio Tools for Microsoft Dynamics GP is installed. If necessary use Mariano’s article to get it installed on later versions of Visual Studio.
  2. Launch Visual Studio and create a new Microsoft Dynamics GP Addin Visual C# project. I called mine SwitchCompanyWidthVC, because I plan to write both a C# and VB.Net version.
  3. In the Solution Explorer, right click on References and select Add Reference.
  4. In the Reference Manager window expand COM and search for “Continuum“.
  5. Select the version of the Dynamics Continuum Integration Library for your version of Microsoft Dynamics GP and click OK.
  6. In the Solution Explorer, right click on References and select Add Reference.
  7. in the Reference Manager windows expand Assemblies and search for “Forms.
  8. Select the System.Windows.Forms assembly and click OK.
  9. In the Solution Explorer, expand References and click on Application.Dynamics. The properties will be displayed. Double click on Copy Local to change it to False.
  10. Repeat previous step for the Microsoft.Dexterity.Bridge reference.
  11. Using Tim’s idea to store the Dexterity sanScript code as a project resource, cut the script below to the clipboard. This is the same script as used in the Dexterity version of the customisation.
  12. In the Solution Explorer, right click on Resources and select Add >> New Item.
  13. In the Add New Item window, under General select Resources File.
  14. Change the Name of the resource from String1 to CompanySwitchScript.
  15. Paste in the Dexterity sanScript code from the clipboard into the Value cell.
  16. Replace the project code with the Visual C# code below.
  17. The changes are:
    1. Adding Namespace for System.Windows.Forms.
    2. Registering the event when the Switch Company form opens.
    3. Handling the event by executing the previously stored Dexterity sanScript code.
  18. From the menus, select Build >> Build Solution.
  19. Copy the file “C:UsersDocumentsVisual Studio 2013ProjectsSwitchCompanyWidthVCSwitchCompanyWidthVCbinx86DebugSwitchCompanyWidthVC.dll” to your application’s Addins folder.

 

Visual C# code

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

namespace SwitchCompanyWidthVC

    public class GPAddIn : IDexterityAddIn
    
        // IDexterityAddIn interface

        public void Initialize()
        
            // Register Event to trigger when Switch Company form opens
            Microsoft.Dexterity.Applications.Dynamics.Forms.SwitchCompany.OpenAfterOriginal += new EventHandler(SwitchCompanyFormPre);
        

        void SwitchCompanyFormPre(object sender, EventArgs e)
        
            Dynamics.Application CompilerApp = new Dynamics.Application();
            string CompilerMessage = "";
            int CompilerError = 0;
            // Execute SanScript in Dynamics GP
            CompilerError = CompilerApp.ExecuteSanscript(Resources.Resource1.CompanySwitchScript, out CompilerMessage);
            if (CompilerError != 0)
            
                MessageBox.Show(CompilerMessage);
            
       }

    }
}

 

 Dexterity sanScript code

local integer l_adjust, h_pos, v_pos, h_size, v_size;

default form to 'Switch Company';
default window to 'Switch Company';

l_adjust = 230;

Field_GetPosition('(L) Company Names', h_pos, v_pos);
Field_GetSize('(L) Company Names', h_size, v_size);

move field '(L) Company Names' to h_pos - l_adjust, -1;
resize field '(L) Company Names' to h_size + l_adjust, -1;

move field '(L) RememberMe' to h_pos - l_adjust, -1;
resize field '(L) RememberMe' to h_size + l_adjust, -1;

move field '(L) SQL Server' to h_pos - l_adjust, -1;
resize field '(L) SQL Server' to h_size + l_adjust, -1;

move field 'User ID' to h_pos - l_adjust, -1;
resize field 'User ID' to h_size + l_adjust, -1;

move field '(L) Number of Users In' to h_pos - l_adjust, -1;
resize field '(L) Number of Users In' to h_size + l_adjust, -1;

move field 'Max Number User In System'[1] to h_pos - l_adjust, -1;
resize field 'Max Number User In System'[1] to h_size + l_adjust, -1;

 

The end result is now the Switch company window has been modified via Visual Studio Tools.

SwitchCompanyWidth

Note: This code is a great example of using pass through Dexterity code from Visual C#, however this technique is not supported by Microsoft.

Thanks to Tim Wappat for pointing me in the right direction.

David

This article was originally posted on http://www.winthropdc.com/blog.

Filed under: Development, Dynamics, GP, Microsoft, Visual Studio Tagged: Continuum, Dexterity, Hybrid, Visual C#, Visual Studio

Read More:
Customising the Company Login window series – Visual Studio Tools revisited – Visual C#

December 15, 2014 · WinthropDC · No Comments
Tags: , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 585

MS Connect Suggestion Sunday: Navigation List … – azurecurve

Some of the sales orders and invoices printed off were coming off in the originating company and others in the functional. … coralcurve | A Consultants Dabblings In Dynamics CRM Perfect Image Email azurecurve View Ian Grieve’s about.me View Ian Grieve’s profile on LinkedIn View azurecurve’s Feed on Twitter MVP Profile View azurecurve’s facebook page View azurecurve’s Google+ View azurecurve’s Summary RSS Feed View azurecurve’s Detailed RSS Feed …

Visit link:
MS Connect Suggestion Sunday: Navigation List … – azurecurve

December 14, 2014 · Ian Grieve · No Comments
Tags: ,  · Posted in: Blogs I Follow Total Views: 245

Dynamics AX – Purchase Order Cycle & Accounting Process (Order, Receipt & Invoices)

Fawad has written a nice and simple post explaining the purchase order process and its accounting entries in Dynamics AX. This really helps for the basic understanding.
Read the complete step by step accounting entries & their effect by each journal on his details post by clicking the link below

Happy Dynamics & Enjoy Learning!

Taken from:
Dynamics AX – Purchase Order Cycle & Accounting Process (Order, Receipt & Invoices)

December 13, 2014 · Waqas Butt · No Comments
Tags: , , , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 341

The Best Thing About Software is People

The best thing about any software company is ‘the people’. Sure the software is important – but it is entirely a reflection of the people on the team. Ever since I have been involved in software I have seen this to be true and it remains the most important thing for me here at eOne. When I started in software and implementing ERP – one of the most important things to the success of a project was

See the article here:
The Best Thing About Software is People

December 12, 2014 · Martin · No Comments
Tags: , , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 212

Dynamics AX 2013 – Royalties Management Step By Step Process

While working on some requirements I came across a very nicely written article on how to use & step royalties management in Dynamics AX 2013 .  
Fawad has written a very detailed post on his blog ( http://fawadb.blogspot.com) on the steps and usage of royalties management in Dynamics AX 2013.
Enjoy reading the completed post by click the below link

Happy Dynamics & Enjoy Learning!

More:
Dynamics AX 2013 – Royalties Management Step By Step Process

December 12, 2014 · Waqas Butt · No Comments
Tags: , , , , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 222

Microsoft Dynamics GP 2015 Developer’s Preview: Wrap Up

It has been an exciting ride combing through the features and capabilities of the Microsoft Dynamics GP 2015 Service Based Architecture components, starting at the core with the new and enhanced .NET interoperability capabilities within Microsoft Dexterity, all the way to the new service base architecture foundation built into Microsoft Dynamics GP to expand the realm of integrations that can be accomplished in today’s fast paced, application (Apps) dominated world, whether those applications are native to the Windows platform or cross-platform, whether they reside in the cloud or on premise, and regardless of the form factor.

I wanted to provide this single point of reference to reach all entries in the series, which saw 5 articles over the past 5 months.

Microsoft Dynamics GP 2015 Developer’s Preview: Loading the VHD image – Part 1 (Aug 29, 2014)
Microsoft Dynamics GP 2015 Developer’s Preview: Working with Sample URIs – Part 2 (Sep 24, 2014)
Microsoft Dynamics GP 2015 Developer’s Preview: .NET Framework Interoperability – Part 3 (Oct 29, 2014)
Microsoft Dynamics GP 2015 Developer’s Preview: Dexterity Service Patterns – Part 4 (Nov 25, 2014)
Microsoft Dynamics GP 2015 Developer’s Preview: Dexterity Service Patterns – Part 5 (Dec 1, 2014)

Since Microsoft Dynamics GP 2015 is now available to the general public, my focus will turn to keeping you abreast of those application nuggets, point out any glaring issues or problems, and continue to work with the development community at large to maximize the technological foundations of the product.

In the future, you may see new series on this blog seeking to enhanced the product learning experience, so stay tuned.

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

Read More:
Microsoft Dynamics GP 2015 Developer’s Preview: Wrap Up

December 11, 2014 · Mariano Gomez · No Comments
Tags: , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 316

eOne’s release plans with Microsoft Dynamics GP 2015

We have been getting requests already for the 2015 builds of the eOne products now that Microsoft has released Microsoft Dynamics GP 2015. So, we wanted to let you know our plans around the releases.

We are hard at work on getting everything ready in all of our products for Microsoft Dynamics GP 2015. We want to be able to add some great new features for you and make sure everything is working

More:
eOne’s release plans with Microsoft Dynamics GP 2015

December 10, 2014 · Nicole Albertson · No Comments
Tags: , , , , , , , , ,  · Posted in: Blogs I Follow Total Views: 271