I am new to VB.NET and only have the vaguest understanding of threading. Thus, as far as I know I'm not even using it. But this morning I created a FileSystemWatcher form which is giving me the above referenced error message. So I looked in the settings and cannot seem to find anything that will help. The searches I do on bing for this tell only a little about it. I'm using VB 2010 Express on a Windows 7 machine.
So I do I check to see if threads are enabled? How do I turn them off because for the moment I can't see any need to make this very simple program anymore complex than needed.
Code:
Imports System.IO
Imports System.Diagnostics
Public Class Form1
Public watcher As FileSystemWatcher
Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
watcher = New FileSystemWatcher
watcher.Path = "C:\0\Testing\FileWatcher"
watcher.NotifyFilter = (NotifyFilters.FileName)
watcher.Filter = "*.eml"
AddHandler watcher.Created, AddressOf logchange
watcher.EnableRaisingEvents = True
btnStart.Enabled = False
btnStop.Enabled = True
txtDwgLog.Text = txtDwgLog.Text & Now.ToString("f") & Chr(9) & "Monitoring Started:" & vbCrLf
End Sub
Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
btnStop.Enabled = False
btnStart.Enabled = True
watcher.EnableRaisingEvents = False
txtDwgLog.Text = txtDwgLog.Text & Now.ToString("f") & Chr(9) & "Monitoring Stopped:" & vbCrLf
End Sub
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
Me.Close()
End Sub
Sub logchange(ByVal source As Object, ByVal e As FileSystemEventArgs)
txtDwgLog.Text = txtDwgLog.Text & Now.ToString("f") & Chr(9) & "Drawing Request Arrived" & vbCrLf
End Sub
End Class