Hello, Im doing ActiveX component with exposed Events. This component will be used in another project and i need to trap events in this another project from activex component. On the ActiveX is only one button and I would like to catch the event when user clicked on this button. The code I have (but doesnt work)
namespace
ActiveX { public interface ActiveXPasswordHolder { Event EventHandler Clicked; }
[
ProgId("ActiveX.PasswordHolder")] [ClassInterface(ClassInterfaceType.AutoDual)] [Serializable]
public partial class PasswordHolder : UserControl, ActiveXPasswordHolder { public event EventHandler Clicked; ... ... ...
public void simpleButton2_Click(object sender, EventArgs e) { EventHandler handler = Clicked; if (handler != null) handler(this, e); } ... ...
When I build this component and add it as reference to another project, I can see the Clicked Event there and can use (this another project is in vb)
Private Sub actxclick(ByVal sender As Object, ByVal e As System.EventArgs) Handles oPasswordHolder.Clicked
Till now its ok, but the problem is, that this event isnt raised at all. When I investigated the problem, I found, that handler is always null, so the line handler(this, e); is never called.
The next problem is, that when I use this component in another project, after adding this component to project, i get error Build xxx, version 0.0.0.0 , culture = neutral, publickeytoken = null was not found. This error come only when Im using Handles oPasswordHolder.Clicked (after removing this, it has no error messages).
Im fighting with this for 3 days without succes. If could somebody move me to the right way, Ill be glad. thanks