L
ljh
Here is the code section I am getting an error on
------------------------------------------
'create a watcher for each file type and hook it to the event subs
Dim i As Integer
For i = 0 To UBound(FileTypes) 'FileTypes is a string array with
stuff like "*.doc" in the arrays
ReDim Preserve Watchers(i)
Watchers(i) = New FileSystemWatcher
With Watchers(i)
.Filter = FileTypes(i).ToString
.EnableRaisingEvents = True
.IncludeSubdirectories = True
.InternalBufferSize = 1277592
.NotifyFilter = IO.NotifyFilters.DirectoryName Or
IO.NotifyFilters.LastWrite Or IO.NotifyFilters.FileName Or
IO.NotifyFilters.Size Or IO.NotifyFilters.Attributes
'add handlers
AddHandler Watchers(i).Changed, AddressOf watch_changed
AddHandler Watchers(i).Created, AddressOf watch_changed
AddHandler Watchers(i).Deleted, AddressOf watch_changed
AddHandler Watchers(i).Renamed, AddressOf watch_renamed
End With
Next
------------------------------------------
The error that I get is "The path is not of a legal form." and it points to
the ".EnableRaisingEvents = True" line of code.
The online help is generic and of no use at all.
I don't get it. There is no "path" here. EnableRaisingEvents does not
require a "path" argument only a boolean.
Without this line, no events are triggered and the code is useless.
Can somebody help me figure this one out? PLEEEEEEASE?
------------------------------------------
'create a watcher for each file type and hook it to the event subs
Dim i As Integer
For i = 0 To UBound(FileTypes) 'FileTypes is a string array with
stuff like "*.doc" in the arrays
ReDim Preserve Watchers(i)
Watchers(i) = New FileSystemWatcher
With Watchers(i)
.Filter = FileTypes(i).ToString
.EnableRaisingEvents = True
.IncludeSubdirectories = True
.InternalBufferSize = 1277592
.NotifyFilter = IO.NotifyFilters.DirectoryName Or
IO.NotifyFilters.LastWrite Or IO.NotifyFilters.FileName Or
IO.NotifyFilters.Size Or IO.NotifyFilters.Attributes
'add handlers
AddHandler Watchers(i).Changed, AddressOf watch_changed
AddHandler Watchers(i).Created, AddressOf watch_changed
AddHandler Watchers(i).Deleted, AddressOf watch_changed
AddHandler Watchers(i).Renamed, AddressOf watch_renamed
End With
Next
------------------------------------------
The error that I get is "The path is not of a legal form." and it points to
the ".EnableRaisingEvents = True" line of code.
The online help is generic and of no use at all.
I don't get it. There is no "path" here. EnableRaisingEvents does not
require a "path" argument only a boolean.
Without this line, no events are triggered and the code is useless.
Can somebody help me figure this one out? PLEEEEEEASE?