Using .NET dll in vb6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Matt Nunnally
    New Member
    • Jul 2007
    • 56

    Using .NET dll in vb6

    I created a .NET dll. I want to try to use it with vb6. I did some research on how to do this, but I want to make sure I'm doing it the ideal way so it will work properly.

    A bit of background on the DLL. I have one class that I want to expose. All the properties that I want to expose are declared public. That class references a few underlying classes, which are all declared as "Friend" and are marked as ComVisible. I have "Register for COM Interop" marked in the compile flags. I also have "Make Assembly COM-Visible" marked in the assembly information.

    I used regasm to register the DLL, which created a .tlb file. In vb6, i tried to reference the .dll but it said cannot add reference. I reference the tlb file and i was able to declare it and use it. I just did a declaration, and did a simple form load which called one of my properties .Name. I know the properties referenced ok because I ran it with no problem. If I changed it to .NAM it failed, which is what I expected. However, none of my properties should up in intellitype. Only the enums.

    Is this correct what I am doing? I'm not very familiar with this type of thing. Is there a way for the properties to show in intellitype?
  • Matt Nunnally
    New Member
    • Jul 2007
    • 56

    #2
    Ok. Figured out the intellitype stuff. I had to declare my exposed class as ComClass.

    So is this right? Will this work with other languages like FoxPro and C++?

    Comment

    • Matt Nunnally
      New Member
      • Jul 2007
      • 56

      #3
      I can reference the tlb file now. I can see all of my properties in intellisense. But in runtime, when it tries to create an instance of it, it gets "the system cannot find the file specified"

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Is the DLL in the correct place? Maybe it needs to be in (either? both?) the directory with your program, or some globally accessable location like \windows\system 32\ ?

        Comment

        Working...