How to make GP company login text boxes longer

In the blog post series by David Musgrave, he shows how to customise the GP company login boxes, to make them long enough to see very long company names in full. David uses Dexterity in the third part of the series. However in the latest he attempts to do the same using an addin, albeit he “cheats” by passing in the SanScript. Note this is not a supported method.
By using the Continuum COM library to allow .NET code in the Dynamics GP Visual Studio addin to pass SanScript through to the GP we CAN do it, see how I did it!

The original article can be found here:


Customising the Company Login window series Part 4 - Visual Studio Toolsby David Musgrave

So David had a problem getting it working, I had Visual Studio open on my Addin project, so I gave it a go.

Make a reference to the Continuum

This is a COM object in, so go to your project reference and search for “contin” and then add the reference. Ensure you marry the version number with the version of GP you are using.


Store the script in a project resource

Under the project settings, you can store resources. This is a good place to put your scripts as it deals with line feeds and keeps them in an intact form for future editing.

Go to the resources tab of the project properties, create a new resource and paste in the script provided by David. We are going to use the .NET code to run the script, so we don’t need to put it in a procedure, only take the fragment that does the deed. Name the resource LoginResizeScript


Add event handler

Now when the company login window is opened we want to execute the script to resize the text boxes on that window. So to me it seems like a good plan to add and event handler to the company switch form. Now go to your GPAddin.vb and add and event handler like this for the company switch form.

Sub Initialize() Implements IDexterityAddIn.Initialize
'You should add code to only execute once in lifetime
AddHandler Microsoft.Dexterity.Applications.DynamicsDictionary.OpenSwitchCompanyFormProcedure._Instance.InvokeAfterOriginal, AddressOf DoLoginResize

End Sub

Deal with the namespaces

Important as the project reference messes you up!

Imports DynamicsGP = Microsoft.Dexterity.Applications.Dynamics

Execute the script

So next the script needs to run in response to the event firing on the Switch Company event handler. Add the following to your GPAddin.vb .

The SanScript is now held in a project resource we can reference by My.Resources.Resources.LoginResizeScript so we push this into the ExecuteSanscript method.

Public Sub DoLoginResize(sender As Object, e As EventArgs)
Dim CompilerApp As New Dynamics.Application
Dim CompilerMessage As String = Nothing
Dim CompilerError As Integer
' Execute SanScript in Dynamics GP
CompilerError = CompilerApp.ExecuteSanscript(My.Resources.Resources.LoginResizeScript, CompilerMessage)
If CompilerError <> 0 Then
End If
End Sub

Resulting resized controls – it works!


And hey it works from VB.NET too! I love Visual Studio and Dynamics GP!

Solved having to click twice to drop a DataGridViewComboBox

The default behaviour of a drop down combobox in a datagridview is for it to require one click to activate it and another to actually drop it down.

Users can’t get this paradigm and so prefer for it to activate immediately on clicking anywhere on the cell. I have seen many solutions on Stackoverflow for this, but most require the arrow part of the cell to be clicked, not working if the user just clicks the cell in the middle. 


I found the following solution to work for me:

Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) _
Handles DataGridView1.CellClick
If (e.ColumnIndex > 0) And e.RowIndex <> -1 Then
With DirectCast(sender, DataGridView)
If .Columns(e.ColumnIndex).Name = "PalletType" Then
.CurrentCell = .Rows(e.RowIndex).Cells(e.ColumnIndex)
DirectCast(.EditingControl, _
System.Windows.Forms.DataGridViewComboBoxEditingControl).DroppedDown = True
End If
End With
End If
End Sub

This makes certain the column is not a header cell, and only does it for the column with the name “PalletType”

I also have the DatagridView set to EditOnEnter for the Edit mode.


WCF Service on Server 2012

The page you are requesting cannot be served because of the extension 
configuration. If the page is a script, add a handler. If the file should be 
downloaded, add a MIME map.

My first experiences with Server 2012 had me puzzled for a few mins when trying to get some WCF service end points transferred from another older 2003 server.

It was solved by going into server manager, drilling down in the add roles and features to the server concerned, selecting Features. under the .NET Framework 4.5 features there was WCF Services, after checking the box and under that also selecting HTTP Activation to on, everything sprang to life.

There are also 3.5 versions of these too if the application is running on the older framework.