freaka61
freaka61

Reputation: 35

Fire DLL event from another DLL (or Application)

I have 2 projects. In the first:

public delegate _Event(int code);
public event _Event TestEvent;

now I want to do something like this in my second project

public void TestFunc()
{
   TestEvent(11); //Project1.MyClass.TestEvent(11);
}

namely I want to fire Project1's event form Project2. Can anybody help me about this?

Upvotes: 0

Views: 619

Answers (1)

Ventsyslav Raikov
Ventsyslav Raikov

Reputation: 7192

1.You're missing the return type on the delegate.

2.You can fire the event from within the declaring type only. What you can do is declare a public method on the type which declares the event which fires it.

public delegate void _Event(int code);
public event _Event TestEvent;
public void FireEvent(int val){TestEvent(val);}

Upvotes: 1

Related Questions