Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add a ToolBoxItem

Status
Not open for further replies.

minhhoa

Programmer
Oct 20, 2002
13
VN
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top