Telerik blogs

The Problem

As Rumen said, adding controls to Visual Studio toolbox can be a tedious procedure. That's why r.a.d.controls are automatically added in the toolbox during installation. This makes it easier for the developer to start using them. However there is a catch - no control is added in Visual Studio 2005... Our toolbox adding code runs without an error but ... nothing happens. Several months ago I found the following forum thread which basically said that the code used to add toolbox items in Visual Studio 2003 will simply not work in Visual Studio 2005. And it is 100% right! We decided to abandon this task and continue with our lives.

In more recent times I came upon the following blog post which looked promising. I downloaded the sample code and ran a couple of tests. And it worked!!! No, it worked only when Visual Studio 2005 had been started beforehand... I instantly imagined the following dialog box "Dear customer, please start your Visual Studio 2005, so we can install our components in your toolbox. Would you?". Yeah, a very bad idea. Once again adding to Visual Studio 2005 was abandoned for better times.

The solution

A few days ago Stoyan brought the following blog post to my attention. The code described there is quite similar to the one we used to add controls to Visual Studio 2003 toolbox but actually works!!! Yes there are ugly COM-ish artefacts:
[ComImport(), Guid("00000016-0000-0000-C000-000000000046"),
InterfaceTypeAttribute(ComInterfaceType
.InterfaceIsIUnknown)]

[DllImport("ole32.dll")]
private static extern int CoRegisterMessageFilter(IOleMessageFilter newFilter, out IOleMessageFilter
oldFilter);
 

It works and I don't care.

So to summarize:

  • To add toolbox items in Visual Studio 2003 you can use the code frome here
  • To add toolbox items in Visual Studio 2005 you should use the code from here

 


rahnev
About the Author

Stefan Rahnev

Stefan Rahnev (@StDiR) is Product Manager for Telerik Kendo UI living in Sofia, Bulgaria. He has been working for the company since 2005, when he started out as a regular support officer. His next steps at Telerik took him through the positions of Technical Support Director, co-team leader in one of the ASP.NET AJAX teams and unit manager for UI for ASP.NET AJAX and Kendo UI. Stefan’s main interests are web development, agile processes planning and management, client services and psychology.

Comments

Comments are disabled in preview mode.