Windows Develop Bookmark and Share   
 index > Windows Forms Designer > [Help!] A Control Derive From a VS auto transfer com control Can not Recognize by VS
 

[Help!] A Control Derive From a VS auto transfer com control Can not Recognize by VS

These Days I want to Use a new third party control, this control is a COM Control.

So I use Visual Studio auto create two namespace "CExcelLib " and "AxCExcelLib ". The "AxCExcelLib " is for Windows Forms. It's contain a control named "AxCExcel ". I can add this control to Tool Item Panel and it work well in my form in design view. It paints cells on my screen well.

And then, I want to expand it. so I create a new class named "RptControl " in namespace "RptControls ", that derived from "AxCExcel ". It compiled without an erro and a warning.
But when I try to add the my control to the panel , the problem comes. The Viusal Studio told me it can not find any controls in the dll file.

What's the problem? I create controls that derive from a .Net control often. There is no problem above.

Do there are some diffences bewtteen creating a control derive from .Net Control and COM Control, Thankes.


RptControls.RptControl -> AxCExcelLib.AxCExcel -> System.Windows.Forms.AxHost --> System.Windows.Forms.Control
|-> System.ComponentModel.ISupportInitialize
|-> System.ComponentModel.ICustomTypeDescriptor






ebread  Tuesday, August 25, 2009 3:20 AM
Hi ebread,

As far as I know, there is few differences between creating a control derive from .Net Control and COM Control. In your case, you need to add a ToolboxItem attribute to the child control. This is the code snippet:

[ToolboxItem(true)]
public class RptControl : AxCExcel
{
}

You can ger more information about ActiveX control from: http://msdn.microsoft.com/en-us/library/aa751972(VS.85).aspx.

Let me know if this helps.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, August 26, 2009 10:39 AM
Does anyone know how to solve it?
ebread  Wednesday, August 26, 2009 5:23 AM
Hi ebread,

As far as I know, there is few differences between creating a control derive from .Net Control and COM Control. In your case, you need to add a ToolboxItem attribute to the child control. This is the code snippet:

[ToolboxItem(true)]
public class RptControl : AxCExcel
{
}

You can ger more information about ActiveX control from: http://msdn.microsoft.com/en-us/library/aa751972(VS.85).aspx.

Let me know if this helps.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, August 26, 2009 10:39 AM
Yeh, it works well. Thanks.
ebread  Tuesday, September 01, 2009 10:25 AM

You can use google to search for other answers

Custom Search

More Threads

• editor in tab view
• Strange Errors in VS.NET
• too slow
• Datagridview: columns keep shifting position
• How I can draw line between two user control?
• winform +fillrectangle transparency +onpaint +invalidate
• Visual Studio 2005 Reinstallation Critical problem
• Error with windows forms with C#
• VS 2008 SP1 abstract Form/UserControl not working even when using Brian Pepin, Urban Potato, technique. Help...
• Custom Control question for experts