blah blah blah is here! blah blah » Close

up0down
link

Hi,
I want to create a setup project such that I can programatically install my user controls to the toolbox.

I tried the following code:

System.Type t = System.Type.GetTypeFromProgID("VisualStudio.DTE.9.0");
object obj = System.Activator.CreateInstance(t, true);
dteObject = (EnvDTE.DTE)obj;
ToolBoxWnd = dteObject.Windows.Item(EnvDTE.Constants.vsWindowKindToolbox);
tlbTabs = ((ToolBox)ToolBoxWnd.Object).ToolBoxTabs;
tlbTab = null;
tlbTab = tlbTabs.Add("TAB1");
ToolBoxWnd.Visible = true;
ToolBoxWnd.DTE.ExecuteCommand("View.PropertiesWindow", "");
tlbTab.Activate();
tlbTab.ToolBoxItems.Item(1).Select();
tlbTab.ToolBoxItems.Add("TAB1",@"C:\DLL\Synchronize.dll", vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
MessageBox.Show("TAB1" + " Succesfully added to ToolBox.", "Add/Remove", MessageBoxButtons.OK, MessageBoxIcon.Information);

the issue i am facing here is that only the tab is getting added and not the controls to the toolbox :( I donno wats the issue here too??

Can anyone please figure out what am I missing here ....is there anything specific to the dll which I should do to get them added to the toolbox??
Is there any other way by which I can programatically add user controls to the toolbox? Urgent need ...Please help
Thanks in advance

last answered 6 months ago

1 answers

up0down
link

This isn't something I've ever done but looking at the documentation for the ToolBoxItems.Add() method, I'd guess that the problem is that you're using the same name (TAB1) for the new item as the tab itself.

So, I'd try using a different name.

Feedback