yyao

Create EventPipeEvents to add handler

Discussion created by yyao on May 2, 2012
Latest reply on May 2, 2012 by mhamel

Here is my code snippet in c#:

 
PISDK.Server _server = _pisdk.Servers["myserver"];
 
// PI Server -> PI Point
PISDK.PIPoint _point = _server.PIPoints["cdt158"];

EventPipeEvents eventPipeEvents = _point.Data.EventPipe.Events;

PISDK._DEventPipeEvents_OnNewValueEventHandler newValueHandler = new PISDK._DEventPipeEvents_OnNewValueEventHandler(EventPipeEvents_OnNewData);

eventPipeEvents.OnNewValue += newValueHandler;

 

 

 

 

When I debug the code, I am getting "Unable to cast COM object of type 'System.__ComObject' to interface type 'PISDK._EventPipeEvents'" on line "EventPipeEvents           eventPipeEvents = _point.Data.EventPipe.Events;"

 

 

 

Please help.

 

 

 

Thanks!

 

 

 

-Yifei

Outcomes