Controlling a Visual Studio Tools Window Position

David MeegoMohammad Daoud has found a great technique to control the initial location of a Visual Studio Tools window, so that it is centered on the screen regardless of resolution.

Please have a look at his blog post for more information: 

Starting the Dynamics GP AddIn form centered in the screen

Thanks for the great work.


Comments (3)
  1. David Musgrave says:

    Forum Post by Borvik

    Helpful code.

  2. Emily H says:

    Hi David!

    I clicked on the link to Mohammad's blog and get a 'sorry this page does not exist'.

    Thinking I need to subscribe to the site to be able to get to it, I tried to add my email address and hit submit.  got back:


    Server Error in '/DynamicsInnovations' Application.


    The ConnectionString property has not been initialized.

     Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized.

    Source Error:

    Line 9:          If Me.btr_email.Value = "" Then Exit Sub

    Line 10:         Dim MainConn As New System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))

    Line 11:         MainConn.Open()

    Line 12:         Dim SQLCmd As New System.Data.SqlClient.SqlCommand("Select * From Contacts WHERE eMail = '" & Me.btr_email.Value & "' IF @@RowCount < 1 INSERT INTO Contacts (EMAIL) VALUES ('" & Me.btr_email.Value & "')", MainConn)

    Line 13:         SQLCmd.ExecuteNonQuery()

    Source File:  \boswinfs03homeuserswebb598whl.daoudmDynamicsInnovationsRSS2MAIL.aspx    Line:  11

    Stack Trace:

    [InvalidOperationException: The ConnectionString property has not been initialized.]

      System.Data.SqlClient.SqlConnection.PermissionDemand() +4876819

      System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) +20

      System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117

      System.Data.SqlClient.SqlConnection.Open() +122

      ASP.rss2mail_aspx.Page_Load(Object sender, EventArgs e) in \boswinfs03homeuserswebb598whl.daoudmDynamicsInnovationsRSS2MAIL.aspx:11

      System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14

      System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35

      System.Web.UI.Control.OnLoad(EventArgs e) +99

      System.Web.UI.Control.LoadRecursive() +50

      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627


    Version Information: Microsoft .NET Framework Version:2.0.50727.3634; ASP.NET Version:2.0.50727.3634 "

    I couldn't find a 'contact us' on his page, thought you might be able to forward this info if you have his email address.

    Take care!


Comments are closed.

Skip to main content