Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

JoeyBlow2

VB.Net calling a COM object error.

This topic is 5303 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using VB.Net to call a COM object that I created, and I''m geting the error:

An unhandled exception of type ''System.NullReferenceException'' occurred in BNetClient.exe

Additional information: Object reference not set to an instance of an object.


 

        Dim result As Integer

        Dim obj As BNet.CComm

        obj = New BNet.CComm

        result = obj.Bind("localhost", "9865")

It happens on my call to obj.Bind... Am I missing something? I have BNet loaded as a COM reference into the project, and the object viewer can correctly get the interface and all the methods, etc. I''ve stuck a breakpoint into the com object call but it never hits it, so I''m thinking its on the VB side or erroring out somewhere in the interopt/com libraries. I''m very new to VB.net (but a master of VB6) so please forgive me if this is a stupid question.

Share this post


Link to post
Share on other sites
Advertisement
At first sight this should work - a couple of questions - do you have on error resume next, and if so have you checked if after the new statement there actually is an object in obj? (sorry if I seem a bit paternalistic, but the only reasons why you should get that exception is that object not being initialized or an error happening inside the com object(although I think that would yield a COM interop exception, but I''m not sure about that))

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!