I have made my own control class by overriding base controls i.e.
[ToolboxData("<{0}:TextBox runat=server></{0}:TextBox>")]
public class MyTextBox:System.Web.UI.WebControls.TextBox
{
public string myProperty {get;set;}
}
now for ease of use, what I do, is to Add these overridden controls in ToolBox window of the visual studio.
To do that, I simply do this.
- Add a new Tab in ToolBox Window by right click and "Add Tab"
- and then I do "Choose Items" (right click) and point to the dll of my control class.
All the controls that I have overridden i.e. TextBox, Button, Label appears there with the new name and icon. All I have to do is to drag them and use them.
Now, Is there a way, that my controls get loaded automatically? I mean I don't want to do above mentioned two steps.
See this is what I did.
Added an add-in and in its Exec, did this
public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled) { handled = false; if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault) { if(commandName == "testAddin.Connect.testAddin") { handled = true; ToolBox tlBox = _applicationObject.ToolWindows.ToolBox; ToolBoxTab tlBoxTab = null; tlBoxTab = tlBox.ToolBoxTabs.Add("Test Controls"); tlBoxTab.Activate(); tlBoxTab.ToolBoxItems.Add("TestControls", @"C:\testLib.dll", vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent); ///// }
...but nothing happened. 'Test Controls' tab was there but no control. When I try to do same with System.Configuration.Install.dll ( found in [root]/Windows/Microsoft.Net/Framework/[dotnetVersion]/) folder).. controls get loaded perfectly..but not when my custom control dll is being pointed.
please help me. I want to add those controls everytime IDE starts up (like telerik controls). am new to this Extensibility Project Type of Visual Studio..
please help....