1

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

Community
  • 1
  • 1
IvanH
  • 5,039
  • 14
  • 60
  • 81
  • 1
    It's not just the properties that make it a control, it's deriving from one of the Control classes. Fixing your properties not showing up and the warnings depends on what the actual warnings are. – Deanna Mar 28 '12 at 15:51
  • I think than vb6 over com does not evaluate .net inheritance. I have added warning example. – IvanH Apr 03 '12 at 08:44
  • Those warnings are normal, most .NET objects are not exposed to COM, only those required to actually implement the correct interface. – Deanna Apr 03 '12 at 10:02
  • Yes, I know they are normal. And also everything works. But I don't like them. So I am looking a way to exclude the not COM visible properties out of interface. So I need to know minimal set of properties which the interface should include. – IvanH Apr 03 '12 at 10:27

1 Answers1

0

Just copy the warnings out and bring them into something like Notepad++. Then you can quickly do up a macro and filter it out so you isolate all the functions that need to be declared. Then just declare them real quick.

Mike Weir
  • 3,094
  • 1
  • 30
  • 46
  • The problem is that I am using `ClassInterfaceType.AutoDual` and the class is derived from `System.Windows.Forms.UserControl`. The wanings are about functions which I **don't want** to be declared. I am looking for those which are necessary. – IvanH Oct 16 '13 at 13:15