Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Invoke winform visual studio addin c# error

$
0
0

Visual studio 2010, C#...

Form1.cs

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Success");
            string projPath = "";

        }
    }


Visual Studio Addin Code (Connect.cs)

public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
		{
			handled = false;
			if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
			{
				if(commandName == "CustomWorkItem.Connect.CustomWorkItem")
				{
					handled = true;
                    Form1 frm = new Form1();
                    frm.Show();
					return;
				}
			}
		}

Problem: So when I click on the Addin under visual studio Tools, it works fine till it shows the message box and then it throws an error causing the visual studio to close..not sure why this is happening..

Do i have to invoke the winform in a different manner?



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>