I have a login form created in VS 2008 and I want it to run an Outlook 2007 addin i created in C# if the login credentials are correct.

So the basic process would be to
1. Enter login details
2. Click Login button
3. If correct details, run Outlook addin
4. If incorrect details, throw MessageBox();

Below is the initial code for my addin.

using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
using System;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace SyncAddin
{
    public partial class ThisAddIn
    {
        //Initialize the Interface variables
        private Office.CommandBar menuBar;
        private Office.CommandBarPopup newMenuBar;
        private Office.CommandBarButton Syncbtn;
        private Office.CommandBarButton AddContactbtn;

        //Allows global connection to be setup.
        private SqlConnection connectionLine;
        private SqlDataReader reader = null; private SqlDataReader reader2 = null;
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            RemoveMenubar();
            AddMenuBar();
            connectToDatabase();
        }

But i would like to begin running this addin frm the Form1.cs ( login form). Is there a way to do this, possibly by creating an instance of the addin and then running it?

Just another update. I have the code below but it doesnt seem to work

ThissAddIn addin = new ThisAddIn();
addin.(whatever method);

but the addin does not get created. Can somebody please help ?

This article has been dead for over six months. Start a new discussion instead.