I have two forms: Form1, and frmMain. Form1 is the sample code from VB .Net to get an icon to appear in the systray for your application. The following code is in Form1 and is used to unload the icon:
Public Sub ExitSelect(ByVal sender As Object, ByVal e As System.EventArgs)
'called when the user selects the 'Exit' context menu
'hide the tray icon
notifyicon.Visible = False
'close up
Me.Close()
End Sub
My main application is frmMain. When I close main, the systray icon remains. I need to be able to call ExitSelect from frmMain. I've tried Form1.ExitSelect() but it complains about their not being an object reference.
Public Sub ExitSelect(ByVal sender As Object, ByVal e As System.EventArgs)
'called when the user selects the 'Exit' context menu
'hide the tray icon
notifyicon.Visible = False
'close up
Me.Close()
End Sub
My main application is frmMain. When I close main, the systray icon remains. I need to be able to call ExitSelect from frmMain. I've tried Form1.ExitSelect() but it complains about their not being an object reference.