macrui

macrui

  • NA
  • 7
  • 0

Sending an event from a class to a form

Sep 16 2004 7:05 AM
Hi, Can someone help please... I'm trying to do the following: create a class (ClassA) that raises an event on a form (FormB) (if it's not open just don't send) not knowing the Form itself. My problem is, i create the definition of the event on the Class A with the delegates, events definition. On the ClassA, when it enters a function, it should raise an event on the FormB (which I don't what the ClassA to know about. Just send to the active delegates. The namespace of the ClassA is completely different from the one from the client and that lib doesn't know the existance of the client form). I always get the message: "Object reference not set to an object instance". I'm I doing this completely wrong? The only thing I managed on ClassA was to close the ActiveForm (and like this I have to have FormB as active, since if I change the focus i will get the message "Object reference not set to an object instance" again. Furthermore, ClassA is MarshalByRef from a server (and defined on client/server)... which I'm not sure affects something on this. I tried to explain the best... Thx Rui

Answers (6)