|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Unknown error....------------------------------------------ '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? Why do you post VB code in the C# newsgroup? Only post in the relevant
groups, "pleeeeeeeeeeeeeeeeeeeeeeease". It's much more likely that you are actually getting the error on the previous line, because you have something in the array that can't be interpreted as a file mask. ljh wrote: Show quoteHide quote > 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? > > "Göran Andersson" <gu***@guffa.com> wrote in message You are right. I had entered ".doc" instead of "*.doc".news:u3xqDEskGHA.1204@TK2MSFTNGP02.phx.gbl... > Why do you post VB code in the C# newsgroup? Only post in the relevant > groups, "pleeeeeeeeeeeeeeeeeeeeeeease". > > It's much more likely that you are actually getting the error on the > previous line, because you have something in the array that can't be > interpreted as a file mask. And I will try and watch where I post more closely. Thanks! Show quoteHide quote > > > ljh wrote: >> 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? I spoke too soon.
The error is still there (even with my fix of ".doc" to "*.doc" for the filter). Show quoteHide quote "ljh" <Reply@groups.please> wrote in message news:aW9lg.16079$gv2.1466@bignews3.bellsouth.net... > > "Göran Andersson" <gu***@guffa.com> wrote in message > news:u3xqDEskGHA.1204@TK2MSFTNGP02.phx.gbl... >> Why do you post VB code in the C# newsgroup? Only post in the relevant >> groups, "pleeeeeeeeeeeeeeeeeeeeeeease". >> >> It's much more likely that you are actually getting the error on the >> previous line, because you have something in the array that can't be >> interpreted as a file mask. > > You are right. I had entered ".doc" instead of "*.doc". > > And I will try and watch where I post more closely. > > Thanks! > >> >> >> ljh wrote: >>> 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? > > I falsely thought that FileSystemWatcher would raise events for the whole
SYSTEM (hence the name, right?). This is not the case. You must provide a FileSystemWatcher.Path to watch for. This also means that you must create a File"System"Watcher component for every drive (physical drives and all networked drives) that you wish to monitor. Show quoteHide quote "ljh" <Reply@groups.please> wrote in message news:sZ9lg.16080$gv2.9096@bignews3.bellsouth.net... >I spoke too soon. > > The error is still there (even with my fix of ".doc" to "*.doc" for the > filter). > > > > "ljh" <Reply@groups.please> wrote in message > news:aW9lg.16079$gv2.1466@bignews3.bellsouth.net... >> >> "Göran Andersson" <gu***@guffa.com> wrote in message >> news:u3xqDEskGHA.1204@TK2MSFTNGP02.phx.gbl... >>> Why do you post VB code in the C# newsgroup? Only post in the relevant >>> groups, "pleeeeeeeeeeeeeeeeeeeeeeease". >>> >>> It's much more likely that you are actually getting the error on the >>> previous line, because you have something in the array that can't be >>> interpreted as a file mask. >> >> You are right. I had entered ".doc" instead of "*.doc". >> >> And I will try and watch where I post more closely. >> >> Thanks! >> >>> >>> >>> ljh wrote: >>>> 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? >> >> > >
How to compare Word Docs?
Changing datagridview cells borders at runtime FolderBrowserDialog hangs in 2005 vs for .Net SUCKS Big Time VB2005 - Sort DataGridView on Text (FormattedValue) of a ComboBox column instead of underlying value Integer literals How can I change a property of a control form Form2 ? Object reference not set to an instance of an object Application.ExecutablePath not recognisze by studio express 2005 Help me about Filter |
|||||||||||||||||||||||