I have been searching and reading for a while now but cannot get my head around events. What I want to do is if some class function returns true I want to raise an event from my main form. I want to raise the same mouse click event as if they clicked on the notify icon.
Do I need to use a delagate?
I am problem doing this all wrong but here is what I have tried.
VB Code:
Public Class EventTest ' Declare the event Private Event NewProductEvent As MouseEventHandler Public Sub Product() Dim IsNewProduct As Boolean = CheckProduct() If IsNewProduct Then OnNewProduct(New MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)) End If End Sub Protected Overridable Sub OnNewProduct(ByVal e As MouseEventArgs) ' This needs to somehow perform the Main.NotifyIcon notifyIcon_MouseClick event. RaiseEvent NewProductEvent(Me, e) End Sub End Class




Reply With Quote