Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Adding Controls to Toolbox With Add-In

Reply
Thread Tools

Adding Controls to Toolbox With Add-In

 
 
Pham Nguyen
Guest
Posts: n/a
 
      01-13-2004
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.vsWindowKindTool box);
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.vsToolBoxItemFormatText);
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?
 
Reply With Quote
 
 
 
 
Pham Nguyen
Guest
Posts: n/a
 
      01-14-2004
Sorry, there was a typo in the code. The line that is supposed to add
the controls is:

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


http://www.velocityreviews.com/forums/(E-Mail Removed) (Pham Nguyen) wrote in message news:<(E-Mail Removed). com>...
> 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.vsWindowKindTool box);
> 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.vsToolBoxItemFormatText);
> 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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Controls To The Visual Studio 2008 Toolbox Nathan Sokalski ASP .Net 2 03-22-2010 02:43 PM
Sharepoint Designer/ Expression Web Designer : adding item in toolbox ? Steve B. ASP .Net 4 06-01-2007 04:29 AM
Adding more html elements in VS.Net toolbox ? Luqman ASP .Net 0 01-25-2006 12:03 PM
Adding Controls to Toolbox With Add-In Pham Nguyen ASP .Net Web Controls 0 01-14-2004 06:24 PM
Adding descended ASP.NET component to toolbox? Lauchlan M ASP .Net 1 08-27-2003 03:41 AM



Advertisments