When I debug my application I am able to use the NotifyIcon1_MouseClick until it reaches a portion of the code. Does Anyone know why it would be doing this and how to resolve it?
Here is my main:
Module Main
Public startdate As DateTime
Public oGvar As New cGVar
Public Event FinishedWritingTxtFile()
Public Event ErrorSendEmail()
Public errorMessage As String
Public Sub main()
'Handlers for events
AddHandler Search.SearchComplete, AddressOf CSV.WriteCSV
AddHandler WritingCSVComplete, AddressOf CSV.ReadCSVWriteSQL
AddHandler WritingSQLComplete, AddressOf TxtFile.WriteLogToFile
'AddHandler DoneSendEmail, AddressOf SendMailAtEnd
AddHandler ErrorSendEmail, AddressOf SendMailAtError
'Initializing
Dim archive As New IO.DirectoryInfo("\\NTServer4\docs\Transcription\")
TxtFile.DeleteContentOfFile()
oGvar.FileCount = 0
oGvar.SQLCount = 0
errorMessage = ""
startdate = DateTime.Now
'Show Notify Form - Tried both notify.show and starting as a thread, both start fine.
'Notify.Show()
Dim windowthread As New Thread(AddressOf Notify.Show)
windowthread.Name = "Window"
windowthread.Start()
'Test msgbox for notifyicon1_mouseclick event -- Works here
MsgBox("made it here")
Try
'Test msgbox for notifyicon1_mouseclick event -- Works here
MsgBox("made it to try")
'my subroutine that searches directory, and writes info to SQL
'Test notifyicon1_mouseclick event -- Stops working once reached this point
Search.SearchDirectoryArchive(archive)
Catch ex As Exception
TxtFile.WriteLogToFile("Main()" + Environment.NewLine + ex.ToString)
errorMessage = ex.ToString
RaiseEvent ErrorSendEmail()
End Try
'Test msgbox for notifyicon1_mouseclick event -- Works here --
'Also any notifyicon1_mouseclick events that happen in try block fire only when out of try block
MsgBox("Past try block")
windowthread.Abort()
'Notify.Close()
'Notify.Dispose()
End Sub
This is the simple Notify.vb
Public Class Notify
Private Sub Notify_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Me.WindowState = Windows.Forms.FormWindowState.Minimized) Then
Me.Hide()
NotifyIcon1.ShowBalloonTip(3000, "Indexer", "Indexer Started", ToolTipIcon.Info)
End If
End Sub
Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
NotifyIcon1.ShowBalloonTip(3000, "Indexer", "Files Indexed: ", ToolTipIcon.None)
End Sub
End Class