I have a winforms control written in vb.net for VB6 program. The control is dynamically added to the VB6 control controls collection.
Set ctrlVB6 = Controls.Add("NETNamespace.SelVB6", "SelNet")
If the .net class (SelVB6
) has all necessary properties the Add method returns VB6 control wrapper and control is visible. Otherwise Add method returns nothing and control is not available in VB6.
The .net class is derived from System.Windows.Forms.UserControl
, which (luckily) has all required properties. The .net class is decorated with ClassInterface
attribute to garantee that properties are available to COM.
<ClassInterface(ClassInterfaceType.AutoDual)>
Public Class SelVB6
Everything works, but not all properties of System.Windows.Forms.UserControl
are com visible and lots of warnings are generated in VS2010. To get rid of warnings I need to know which properties are necessary, define an interface and use ClassInterfaceType.None
.
Notes
I am not allowed to use Interop Forms Toolkit.
I know that I can list control properties Control Properties in Visual Basic 6.
Warning example:
Type library exporter warning processing 'NETNamespace.SelVB6.PreProcessControlMessage(#0)'. Warning: Non COM visible value type 'System.Windows.Forms.PreProcessControlState' is being referenced either from the type currently being exported or from one of its base types. Microsoft.Common.targets