Adding Controls to Toolbox With Add-In

Discussion in 'ASP .Net Web Controls' started by Pham Nguyen, Jan 14, 2004.

  1. Pham Nguyen

    Pham Nguyen Guest

    I'm having problems creating an add-in to install a library of custom
    controls I have in the toolbox. I've created a Visual Studio .NET
    Add-in project and implemented this code in the OnConnection() method:

    public void OnConnection(object application,
    Extensibility.ext_ConnectMode connectMode, object addInInst, ref
    System.Array custom)
    {

    DTE env = (DTE)application;
    // env.ExecuteCommand("View.PropertiesWindow", String.Empty);

    Window win =
    env.Windows.Item(EnvDTE.Constants.vsWindowKindToolbox);
    ToolBox tb = (ToolBox)win.Object;
    ToolBoxTabs tbts = tb.ToolBoxTabs;
    ToolBoxTab tbt = tbts.Add("My Tab");
    tbt.Activate();

    tbt.ToolBoxItems.Add("", @"D:\Controls\MyControls.dll",
    vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent)

    tbt.ToolBoxItems.Add("My Text Item", "My Text...",
    vsToolBoxItemFormat.vsToolBoxItemFormatText);
    }

    The text item gets added just fine, but none of the controls get
    loaded (if I put in a bogus path for the controls DLL, though, I do
    get an error). I read about a possible bug in VS.NET where controls
    will not get added if the Properties window isn't open, but when I
    uncomment the line in the code above that does that, I get a "Not
    enough storage is available to complete the operation" error. Is there
    something off about the code above?
    Pham Nguyen, Jan 14, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lauchlan M
    Replies:
    1
    Views:
    410
    Lauchlan M
    Aug 27, 2003
  2. Chad Scharf
    Replies:
    3
    Views:
    859
    Chad Scharf
    Oct 18, 2007
  3. Nathan Sokalski
    Replies:
    2
    Views:
    1,092
    Nathan Sokalski
    Mar 22, 2010
  4. Pham Nguyen

    Adding Controls to Toolbox With Add-In

    Pham Nguyen, Jan 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    183
    Pham Nguyen
    Jan 14, 2004
  5. ABC

    How to add my web user controls to toolbox?

    ABC, Nov 4, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    145
Loading...

Share This Page