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. Visual Basic
  4. DLL Question

DLL Question

Scheduled Pinned Locked Moved Visual Basic
tutorialquestioncsharpdebugging
3 Posts 3 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.
  • N Offline
    N Offline
    No e
    wrote on last edited by
    #1

    I am converting a vb6 project to .net, slowly but surely. If the VB6 project I had a DLL we wrote, I add a reference in the VB6 program and wala I could use it. I tried a similar thing in .net but I get a "Object reference not set to an instance of an object." when I try to call something in the dll. I am not sure how to properly do this in VS2008, do I need to do some additional initialization? How would I do it if I wanted to debug the code of the DLL when I am running the secondary project? in VB6 I could point a reference to the VB project for the DLL, not sure how to do that either. If it not a quick answer, can any one point me to a tutorial of some nature? Not quite what to google...

    D L 2 Replies Last reply
    0
    • N No e

      I am converting a vb6 project to .net, slowly but surely. If the VB6 project I had a DLL we wrote, I add a reference in the VB6 program and wala I could use it. I tried a similar thing in .net but I get a "Object reference not set to an instance of an object." when I try to call something in the dll. I am not sure how to properly do this in VS2008, do I need to do some additional initialization? How would I do it if I wanted to debug the code of the DLL when I am running the secondary project? in VB6 I could point a reference to the VB project for the DLL, not sure how to do that either. If it not a quick answer, can any one point me to a tutorial of some nature? Not quite what to google...

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

      Without seeing the code that's throwing the exception, it's pretty difficult to tell you what went wrong. But, you only get that message when you try to use a variable that contains null (Nothing in VB). The whole process is really not very different than it was in VB6.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      1 Reply Last reply
      0
      • N No e

        I am converting a vb6 project to .net, slowly but surely. If the VB6 project I had a DLL we wrote, I add a reference in the VB6 program and wala I could use it. I tried a similar thing in .net but I get a "Object reference not set to an instance of an object." when I try to call something in the dll. I am not sure how to properly do this in VS2008, do I need to do some additional initialization? How would I do it if I wanted to debug the code of the DLL when I am running the secondary project? in VB6 I could point a reference to the VB project for the DLL, not sure how to do that either. If it not a quick answer, can any one point me to a tutorial of some nature? Not quite what to google...

        L Offline
        L Offline
        Luc Pattyn
        wrote on last edited by
        #3

        Assuming your DLL contains native code, you would need P/Invoke to call that from a managed language such as C# or VB.NET; here is an article that should get you on the right track: pinvoke1[^]. I suggest you start with the simplest call available in the DLL, and learn the techniques step by step. :)

        Luc Pattyn [My Articles] Nil Volentibus Arduum

        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