Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Use c# dll in vb.6

Use c# dll in vb.6

Scheduled Pinned Locked Moved C#
comhelpquestioncsharp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cliffer
    wrote on last edited by
    #1

    Hello, i need to call c# dll on vb.6 program, i try this: using System; c# class: namespace COMInterop { public class TestCom { public TestCom() { } public string Hello() { return "hello"; } } } then i go to vb6 , i add the reference on my COMInterop.tlb and i copy the dll on the working folder of vb6 program. vb6 code : Private Sub Form_Load() Dim temp As New COMInterop.TestCom MsgBox(temp.Hello) End Sub and it work properly. but on this way i have to add the reference on my vb6 project. how can i use my dll without doing this? i try to do: Private Sub Form_Load() Dim temp As Object Set temp = CreateObject(TestCom) End Sub but this give me an error: Run-Time error '429': ActiveX component can't create object Some one can help me? thanks

    D 1 Reply Last reply
    0
    • C Cliffer

      Hello, i need to call c# dll on vb.6 program, i try this: using System; c# class: namespace COMInterop { public class TestCom { public TestCom() { } public string Hello() { return "hello"; } } } then i go to vb6 , i add the reference on my COMInterop.tlb and i copy the dll on the working folder of vb6 program. vb6 code : Private Sub Form_Load() Dim temp As New COMInterop.TestCom MsgBox(temp.Hello) End Sub and it work properly. but on this way i have to add the reference on my vb6 project. how can i use my dll without doing this? i try to do: Private Sub Form_Load() Dim temp As Object Set temp = CreateObject(TestCom) End Sub but this give me an error: Run-Time error '429': ActiveX component can't create object Some one can help me? thanks

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Cliffer wrote:

      but on this way i have to add the reference on my vb6 project. how can i use my dll without doing this?

      You can't. None of the Managed Code languages support exporting methods in a way that would allow you do this. You have to go through the COM reference to get at a Managed Code .DLL's methods. Dave Kreskowiak Microsoft MVP - Visual Basic

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups