VB.Net calling a COM object error.

Started by
1 comment, last by JoeyBlow2 20 years, 3 months ago
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.
Advertisement
BUMP. Please don''t make me re-write my COM object in .Net. =)
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))

This topic is closed to new replies.

Advertisement