Hi,

I have referenced a COM Interface from a VB6 COM-DLL (WorkerInterfacese.dll)
and implement it in a c# class:

  public class CsWorker : WorkerInterfaces.IWorker
  {
     // methods of the COM IWorker Interface
      public void DoTheWork()
      {
          // do something
      }
  }

(Project settings are "register for COM interop". No special attributes are
used.)

At this point everything works fine. I can acces my class from an external
VB6 programm as expected.

Now I want to pass an object of my class to an other COM object which was
also implemented in VB6. The type of the COM class (JobController) was
referenced per .dll.

The class has one method which looks like

  AcceptWorker( ref WorkerInterfaces.IWorker )

I want to call this method with a reference to myWorker as an argument:

  WorkerInterfaces.IWorker myWorker = new CsWorker();

  COMJobController.JobControl jobControl = new COMJobController.JobControl
();

  try
  {
      jobControl.AcceptWorker(ref myWorker);
  }

  catch (Exception e)
  {
      ...
  }


As soon as the called jobControl object tries to access myWorker (invokes
the DoTheWork() method on my objcect) I catch an exception  "Object
reference not set to an instance of an object".

Any ideas what's going wrong in this code?

Thanks in advance,
Bernd.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to