i am using FileSystemWatcher to see if a *.bat file exists in the directory and if so then process it but it's processing all files and crashing the app.
here is the code i am using.
can someone help me out with this?
here is the code i am using.
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
lstFiles.Items.Clear()
'lstFiles.Items.Add(Now.ToString() & " Starting")
' Get the path to the directory we will watch.
m_WatchDirectory = "c:\temp\BAT_Files\" 'Application.StartupPath 'THIS IS THE PATH IT LOOKS FOR THE .BAT FILES
m_WatchDirectory = m_WatchDirectory.Substring(0, _
m_WatchDirectory.LastIndexOf("\"))
m_WatchDirectory &= "\"
' Make the FileSystemWatcher.
m_FileSystemWatcher = New FileSystemWatcher(m_WatchDirectory, "*.bat")
m_FileSystemWatcher.NotifyFilter = 0
m_FileSystemWatcher.NotifyFilter = _
m_FileSystemWatcher.NotifyFilter Or _
NotifyFilters.FileName
m_FileSystemWatcher.EnableRaisingEvents = True
' Process any files that already exist.
ProcessExistingFiles(m_WatchDirectory)
End Sub