Register .Net Components for COM

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mihiri

    Register .Net Components for COM

    Hi,
    I have created a simple managed component in vb.Net with a public class
    exposing a public function. I successfully registered it using 'Regasm.exe'
    .. But
    when I tired to access it in vb 6.0( using late binding) it gives an error .
    I cannot view managed component in Ole View .
    Both managed componet and vb 6.0 exe are in the same folder.
    How Can I successfully register my component for COM?

    Thanks



  • Ken Tucker [MVP]

    #2
    Re: Register .Net Components for COM

    Hi,

    The public classes in vb.net dl must be marked as comvisible for them
    to work with vb6.




    Ken
    -----------------------
    "Mihiri" <Mihiri@discuss ions.microsoft. com> wrote in message
    news:5C5E8A0B-1FE5-4EB9-A860-91501759ABF0@mi crosoft.com...[color=blue]
    > Hi,
    > I have created a simple managed component in vb.Net with a public class
    > exposing a public function. I successfully registered it using
    > 'Regasm.exe'
    > . But
    > when I tired to access it in vb 6.0( using late binding) it gives an error
    > .
    > I cannot view managed component in Ole View .
    > Both managed componet and vb 6.0 exe are in the same folder.
    > How Can I successfully register my component for COM?
    >
    > Thanks
    >
    >
    >[/color]


    Comment

    • Phill.  W

      #3
      Re: Register .Net Components for COM

      "Mihiri" <Mihiri@discuss ions.microsoft. com> wrote in message
      news:5C5E8A0B-1FE5-4EB9-A860-91501759ABF0@mi crosoft.com...[color=blue]
      > I have created a simple managed component in vb.Net with a
      > public class exposing a public function. I successfully registered it
      > using 'Regasm.exe'.[/color]
      [color=blue]
      > I cannot view managed component in Ole View .[/color]

      Try using the TypeLib (tlb) created by regasm instead.
      [color=blue]
      > Both managed componet and vb 6.0 exe are in the same folder.[/color]

      Irrelevant - COM always finds components via the location held in
      the Registry.

      HTH,
      Phill W.


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Register .Net Components for COM

        "Mihiri" <Mihiri@discuss ions.microsoft. com> schrieb:[color=blue]
        > I have created a simple managed component in vb.Net with a public class
        > exposing a public function. I successfully registered it using
        > 'Regasm.exe'
        > . But
        > when I tired to access it in vb 6.0( using late binding) it gives an error
        > .
        > I cannot view managed component in Ole View .[/color]

        Make sure you reference the type library file (".tlb") instead of the DLL.

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        • TrtnJohn

          #5
          RE: Register .Net Components for COM

          You cannot view the DLL in OLE View because it is just an assembly not a COM
          DLL. It is better to create your class as a COM class in the IDE and set the
          COM Interop option for the project you are compiling. Making your class a
          COM class in the IDE will automatically add the class attributes to assign
          GUIDs to the interfaces. Otherwise, you'll get new GUIDS all of the time. A
          COM type library will not be generated unless you set COM Interop for the
          project. If you do all this you can use RegAsm to register and unregister
          the assembly on other machines.

          "Mihiri" wrote:
          [color=blue]
          > Hi,
          > I have created a simple managed component in vb.Net with a public class
          > exposing a public function. I successfully registered it using 'Regasm.exe'
          > . But
          > when I tired to access it in vb 6.0( using late binding) it gives an error .
          > I cannot view managed component in Ole View .
          > Both managed componet and vb 6.0 exe are in the same folder.
          > How Can I successfully register my component for COM?
          >
          > Thanks
          >
          >
          >[/color]

          Comment

          Working...