3

I have a C# .NET 4.5 user control that I need to make available to a legacy project in VB6. (Part of a slow migration away from VB, but we can't do it all at once.)

I have been using a sample .NET-based, C# ActiveX control project from Microsoft from

https://code.msdn.microsoft.com/windowsapps/csactivex-b86194f8

I can get the project to build and I can register the .DLL it creates on the target machine using regasm like

%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\regasm.exe CSActiveX.ocx /codebase

and that registers without a problem.

However, when I look in VB I do not see the control as a component and when I try to "manually" add it by browsing to the control and adding it I get the error message

The file XXXXXX is not registerable as an ActiveX component.

(Note I have been trying this, and the regasm step with the DLL using both a .DLL extension and a .OCX extension on the file. I am not sure if that matters. I get the same error either way.)

I am assuming that VB6 is giving me this error because the ActiveX component needs to be registered with regasm.exe and it is trying to register it with RegSvr32. How do I get around this?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
user2735420
  • 106
  • 5
  • 5
    The VB6 ide needs the type library, you did not create one. Add the /tlb option. – Hans Passant Feb 07 '18 at 17:20
  • 1
    That was the problem. (If Hans's comment was not clear, I added "/tbl" on the regasm statement and then the component appeared in VB 6's list of components.) thanks. – user2735420 Feb 07 '18 at 18:55

0 Answers0