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. Reference to a non-shared member requires an object reference

Reference to a non-shared member requires an object reference

Scheduled Pinned Locked Moved Visual Basic
helpcsharpcomxml
5 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.
  • G Offline
    G Offline
    Geoff_3001
    wrote on last edited by
    #1

    Iam currently wirting a vb.net 2003 dll which links to a 3rd party com dll. I have successfuly created a com class project and registerd the dll using regasm. There is very little docs (not a surprize) and when calling the below function ProcessXMLFile("C:\myxl.xml) I get a bulid error saying "Reference to a non-shared member requires an object reference" I have found lots of refrences to this error online, but none that help in this situation. I relise the information is a little thin, not sure I have any more info but if you need more ask and I will try and provide. Thanks in advance

    C 1 Reply Last reply
    0
    • G Geoff_3001

      Iam currently wirting a vb.net 2003 dll which links to a 3rd party com dll. I have successfuly created a com class project and registerd the dll using regasm. There is very little docs (not a surprize) and when calling the below function ProcessXMLFile("C:\myxl.xml) I get a bulid error saying "Reference to a non-shared member requires an object reference" I have found lots of refrences to this error online, but none that help in this situation. I relise the information is a little thin, not sure I have any more info but if you need more ask and I will try and provide. Thanks in advance

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Sounds to me like the ProcessXMLFile method is not static, and so requires an instance of an object to call it from.  As you say, not much to go on, so I'm guessing'  The other thing is, your quotes are not closed, I asume that's just a typo in your post, not in your code.

      Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

      G 1 Reply Last reply
      0
      • C Christian Graus

        Sounds to me like the ProcessXMLFile method is not static, and so requires an instance of an object to call it from.  As you say, not much to go on, so I'm guessing'  The other thing is, your quotes are not closed, I asume that's just a typo in your post, not in your code.

        Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

        G Offline
        G Offline
        Geoff_3001
        wrote on last edited by
        #3

        Thanks, I agree that that sounds like the problem from my research. I have no clue how I would provide an instance of the oblect (I more use to borland c++ circa 1992) I found the following in the docs regarding the method HRESULT ProcessXMLFile ([in] BSTR filename, [out, retval] BSTR * errors) ; and Method ProcessXMLFile This method is used to process an XML document stored on disc, and uses the following parameters: Parameter Description BSTR filename File name and path of the XML document. BSTR * errors Output error string. Cheers

        C 1 Reply Last reply
        0
        • G Geoff_3001

          Thanks, I agree that that sounds like the problem from my research. I have no clue how I would provide an instance of the oblect (I more use to borland c++ circa 1992) I found the following in the docs regarding the method HRESULT ProcessXMLFile ([in] BSTR filename, [out, retval] BSTR * errors) ; and Method ProcessXMLFile This method is used to process an XML document stored on disc, and uses the following parameters: Parameter Description BSTR filename File name and path of the XML document. BSTR * errors Output error string. Cheers

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Once you import your COM library, are you creating an instance of the stub class it provides ? If not, you've not got a COM object to call methods on.  What's your actual code look like, is it MyCOMObjectInstance.ProcessXMLFile("whatever") Or, was the line of code exactly as you posted it ?

          Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

          G 1 Reply Last reply
          0
          • C Christian Graus

            Once you import your COM library, are you creating an instance of the stub class it provides ? If not, you've not got a COM object to call methods on.  What's your actual code look like, is it MyCOMObjectInstance.ProcessXMLFile("whatever") Or, was the line of code exactly as you posted it ?

            Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

            G Offline
            G Offline
            Geoff_3001
            wrote on last edited by
            #5

            Christian, Thanks a lot for your help, the mud becomes ever clearer. I was calling with as posted, I changed it as you suggested and it fires the method. Of course I now get a new error, but hey no one said it would be easy. Thanks again Geoff

            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