I try to develop an Addin using C# in which I create a custom toolboxbar and intend to add some system .NET controls such as "Button", "CheckBox" to it. The problem is that there is no thrown exception but it shows no toolbox items in my custom tool bar. Below is the source code I write in an Addin:
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
{
// ...
_DTE applicationObject = (_DTE)application;
ToolBox oToolBox = (ToolBox)applicationObject.Windows.Item(Constants.vsWindowKindToolbox).Object;
ToolBoxTabs oToolBoxTabs = oToolBox.ToolBoxTabs;
ToolBoxTab oToolBoxTab = oToolBoxTabs.Add("My Tab"
ToolBoxItem oToolBoxItem = oToolBoxTab.ToolBoxItems.Add("Button,System.Windows.Forms", null, vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
// After this code line, ToolBoxItem==null. There is no items added to my toolbox tab.
// ...
}
Any assistance is greatly appreciated.
Minh Hoa
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
{
// ...
_DTE applicationObject = (_DTE)application;
ToolBox oToolBox = (ToolBox)applicationObject.Windows.Item(Constants.vsWindowKindToolbox).Object;
ToolBoxTabs oToolBoxTabs = oToolBox.ToolBoxTabs;
ToolBoxTab oToolBoxTab = oToolBoxTabs.Add("My Tab"
ToolBoxItem oToolBoxItem = oToolBoxTab.ToolBoxItems.Add("Button,System.Windows.Forms", null, vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
// After this code line, ToolBoxItem==null. There is no items added to my toolbox tab.
// ...
}
Any assistance is greatly appreciated.
Minh Hoa