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:
  1. Public Class EventTest
  2. ' Declare the event
  3. Private Event NewProductEvent As MouseEventHandler
  4.  
  5. Public Sub Product()
  6.    Dim IsNewProduct As Boolean = CheckProduct()
  7.    If IsNewProduct Then
  8.             OnNewProduct(New MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0))
  9.    End If
  10. End Sub
  11.  
  12. Protected Overridable Sub OnNewProduct(ByVal e As MouseEventArgs)
  13.      ' This needs to somehow perform the Main.NotifyIcon  notifyIcon_MouseClick event.
  14.         RaiseEvent NewProductEvent(Me, e)
  15.     End Sub
  16. End Class