IanG on Tap

Ian Griffiths in Weblog Form (RSS 2.0)

Blog Navigation

August (2014)

(1 item)

July (2014)

(5 items)

April (2014)

(1 item)

March (2014)

(1 item)

January (2014)

(2 items)

November (2013)

(2 items)

July (2013)

(4 items)

April (2013)

(1 item)

February (2013)

(6 items)

September (2011)

(2 items)

November (2010)

(4 items)

September (2010)

(1 item)

August (2010)

(4 items)

July (2010)

(2 items)

September (2009)

(1 item)

June (2009)

(1 item)

April (2009)

(1 item)

November (2008)

(1 item)

October (2008)

(1 item)

September (2008)

(1 item)

July (2008)

(1 item)

June (2008)

(1 item)

May (2008)

(2 items)

April (2008)

(2 items)

March (2008)

(5 items)

January (2008)

(3 items)

December (2007)

(1 item)

November (2007)

(1 item)

October (2007)

(1 item)

September (2007)

(3 items)

August (2007)

(1 item)

July (2007)

(1 item)

June (2007)

(2 items)

May (2007)

(8 items)

April (2007)

(2 items)

March (2007)

(7 items)

February (2007)

(2 items)

January (2007)

(2 items)

November (2006)

(1 item)

October (2006)

(2 items)

September (2006)

(1 item)

June (2006)

(2 items)

May (2006)

(4 items)

April (2006)

(1 item)

March (2006)

(5 items)

January (2006)

(1 item)

December (2005)

(3 items)

November (2005)

(2 items)

October (2005)

(2 items)

September (2005)

(8 items)

August (2005)

(7 items)

June (2005)

(3 items)

May (2005)

(7 items)

April (2005)

(6 items)

March (2005)

(1 item)

February (2005)

(2 items)

January (2005)

(5 items)

December (2004)

(5 items)

November (2004)

(7 items)

October (2004)

(3 items)

September (2004)

(7 items)

August (2004)

(16 items)

July (2004)

(10 items)

June (2004)

(27 items)

May (2004)

(15 items)

April (2004)

(15 items)

March (2004)

(13 items)

February (2004)

(16 items)

January (2004)

(15 items)

Blog Home

RSS 2.0

Writing

Programming C# 5.0

Programming WPF

Other Sites

Interact Software

The Quick Way To Add Components to the VS.NET Toolbox

Tuesday 6 April, 2004, 11:20 PM

Visual Studio .NET lets you add new components to the toolbox. The way most people do this is to right click on the toolbox tab they want to customize, and select the 'Add/Remove Items...' menu item. But this can be a bit tedious, since it can take a while to build the list of installed components.

It's particularly bad if you're using a system with a relatively slow hard disk, such as most laptops have. It took an astonishing 55 seconds just now on my laptop. (It only took one second next time round, since everything was in the disk cache. But since I tend to customize my toolbox fairly rarely, it's the first run that counts, and it's badly disk-bound.) It doesn't help that my laptop has a 4,200rpm hard disk, a strange choice there from Dell on an otherwise reasonably high-spec system. I'm waiting for an 80GB 7,200rpm laptop hard disk to come out before upgrading - the 7,200rpm 60GB ones have been out for almost a year now, so surely it can't be much longer! I'm guessing they're waiting until they're sure that they won't see a rerun of the production problems that plagued the early 7,200rpm 60GB drives. But I digress...

It's aggravating to wait so long for this list to appear just so you can press the Browse... button to go and find the component you actually wanted. It'd be nice if this dialog were multithreaded, so it let you browse for external components without having to wait for the usual list to appear first. But it's not.

So I rarely use this dialog. I usually use a little-known trick. If you have a .NET DLL containing components you'd like to add to the toolbox, you can just drag it directly out of a Windows Explorer window onto the toolbox. VS.NET will go through the DLL and add any class that implements IComponent to the toolbox tab you dropped the component onto. No need to wait for the Customize Toolbox dialog to appear.

Note: if you drop the DLL onto some other part of VS.NET (i.e. you don't drop it onto a tab on the toolbox) it'll just open up the DLL in resource view mode. Also, if the DLL doesn't actually contain any components (i.e. there's nothing in there that could appear on the toolbox) it will also revert to resource view mode. Also, note that if any kind of error occurs when VS.NET tries to load the DLL, it will revert to showing the resource view rather than displaying an error.

Copyright © 2002-2013, Interact Software Ltd. Content by Ian Griffiths. Please direct all Web site inquiries to webmaster@interact-sw.co.uk