Unknown error....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ljh

    #1

    Unknown error....

    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(FileType s) 'FileTypes is a string array with
    stuff like "*.doc" in the arrays
    ReDim Preserve Watchers(i)
    Watchers(i) = New FileSystemWatch er
    With Watchers(i)
    .Filter = FileTypes(i).To String
    .EnableRaisingE vents = True
    .IncludeSubdire ctories = True
    .InternalBuffer Size = 1277592
    .NotifyFilter = IO.NotifyFilter s.DirectoryName Or
    IO.NotifyFilter s.LastWrite Or IO.NotifyFilter s.FileName Or
    IO.NotifyFilter s.Size Or IO.NotifyFilter s.Attributes

    'add handlers
    AddHandler Watchers(i).Cha nged, AddressOf watch_changed
    AddHandler Watchers(i).Cre ated, AddressOf watch_changed
    AddHandler Watchers(i).Del eted, AddressOf watch_changed
    AddHandler Watchers(i).Ren amed, 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 ".EnableRaising Events = 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. EnableRaisingEv ents 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

    #2
    Re: Unknown error....

    Why do you post VB code in the C# newsgroup? Only post in the relevant
    groups, "pleeeeeeeeeeee eeeeeeeeeeease" .

    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:[color=blue]
    > 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(FileType s) 'FileTypes is a string array with
    > stuff like "*.doc" in the arrays
    > ReDim Preserve Watchers(i)
    > Watchers(i) = New FileSystemWatch er
    > With Watchers(i)
    > .Filter = FileTypes(i).To String
    > .EnableRaisingE vents = True
    > .IncludeSubdire ctories = True
    > .InternalBuffer Size = 1277592
    > .NotifyFilter = IO.NotifyFilter s.DirectoryName Or
    > IO.NotifyFilter s.LastWrite Or IO.NotifyFilter s.FileName Or
    > IO.NotifyFilter s.Size Or IO.NotifyFilter s.Attributes
    >
    > 'add handlers
    > AddHandler Watchers(i).Cha nged, AddressOf watch_changed
    > AddHandler Watchers(i).Cre ated, AddressOf watch_changed
    > AddHandler Watchers(i).Del eted, AddressOf watch_changed
    > AddHandler Watchers(i).Ren amed, 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 ".EnableRaising Events = 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. EnableRaisingEv ents 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?
    >
    >[/color]

    Comment

    • ljh

      #3
      Re: Unknown error....


      "Göran Andersson" <guffa@guffa.co m> wrote in message
      news:u3xqDEskGH A.1204@TK2MSFTN GP02.phx.gbl...[color=blue]
      > Why do you post VB code in the C# newsgroup? Only post in the relevant
      > groups, "pleeeeeeeeeeee eeeeeeeeeeease" .
      >
      > 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.[/color]

      You are right. I had entered ".doc" instead of "*.doc".

      And I will try and watch where I post more closely.

      Thanks!
      [color=blue]
      >
      >
      > ljh wrote:[color=green]
      >> 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(FileType s) 'FileTypes is a string array
      >> with stuff like "*.doc" in the arrays
      >> ReDim Preserve Watchers(i)
      >> Watchers(i) = New FileSystemWatch er
      >> With Watchers(i)
      >> .Filter = FileTypes(i).To String
      >> .EnableRaisingE vents = True
      >> .IncludeSubdire ctories = True
      >> .InternalBuffer Size = 1277592
      >> .NotifyFilter = IO.NotifyFilter s.DirectoryName Or
      >> IO.NotifyFilter s.LastWrite Or IO.NotifyFilter s.FileName Or
      >> IO.NotifyFilter s.Size Or IO.NotifyFilter s.Attributes
      >>
      >> 'add handlers
      >> AddHandler Watchers(i).Cha nged, AddressOf watch_changed
      >> AddHandler Watchers(i).Cre ated, AddressOf watch_changed
      >> AddHandler Watchers(i).Del eted, AddressOf watch_changed
      >> AddHandler Watchers(i).Ren amed, 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 ".EnableRaising Events = 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. EnableRaisingEv ents 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?[/color][/color]


      Comment

      • ljh

        #4
        Crap!

        I spoke too soon.

        The error is still there (even with my fix of ".doc" to "*.doc" for the
        filter).



        "ljh" <Reply@groups.p lease> wrote in message
        news:aW9lg.1607 9$gv2.1466@bign ews3.bellsouth. net...[color=blue]
        >
        > "Göran Andersson" <guffa@guffa.co m> wrote in message
        > news:u3xqDEskGH A.1204@TK2MSFTN GP02.phx.gbl...[color=green]
        >> Why do you post VB code in the C# newsgroup? Only post in the relevant
        >> groups, "pleeeeeeeeeeee eeeeeeeeeeease" .
        >>
        >> 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.[/color]
        >
        > You are right. I had entered ".doc" instead of "*.doc".
        >
        > And I will try and watch where I post more closely.
        >
        > Thanks!
        >[color=green]
        >>
        >>
        >> ljh wrote:[color=darkred]
        >>> 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(FileType s) 'FileTypes is a string array
        >>> with stuff like "*.doc" in the arrays
        >>> ReDim Preserve Watchers(i)
        >>> Watchers(i) = New FileSystemWatch er
        >>> With Watchers(i)
        >>> .Filter = FileTypes(i).To String
        >>> .EnableRaisingE vents = True
        >>> .IncludeSubdire ctories = True
        >>> .InternalBuffer Size = 1277592
        >>> .NotifyFilter = IO.NotifyFilter s.DirectoryName Or
        >>> IO.NotifyFilter s.LastWrite Or IO.NotifyFilter s.FileName Or
        >>> IO.NotifyFilter s.Size Or IO.NotifyFilter s.Attributes
        >>>
        >>> 'add handlers
        >>> AddHandler Watchers(i).Cha nged, AddressOf watch_changed
        >>> AddHandler Watchers(i).Cre ated, AddressOf watch_changed
        >>> AddHandler Watchers(i).Del eted, AddressOf watch_changed
        >>> AddHandler Watchers(i).Ren amed, 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 ".EnableRaising Events = 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. EnableRaisingEv ents 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?[/color][/color]
        >
        >[/color]


        Comment

        • ljh

          #5
          Re: Crap! - OK ... I got it.....

          I falsely thought that FileSystemWatch er would raise events for the whole
          SYSTEM (hence the name, right?).

          This is not the case.

          You must provide a FileSystemWatch er.Path to watch for. This also means
          that you must create a File"System"Wat cher component for every drive
          (physical drives and all networked drives) that you wish to monitor.


          "ljh" <Reply@groups.p lease> wrote in message
          news:sZ9lg.1608 0$gv2.9096@bign ews3.bellsouth. net...[color=blue]
          >I spoke too soon.
          >
          > The error is still there (even with my fix of ".doc" to "*.doc" for the
          > filter).
          >
          >
          >
          > "ljh" <Reply@groups.p lease> wrote in message
          > news:aW9lg.1607 9$gv2.1466@bign ews3.bellsouth. net...[color=green]
          >>
          >> "Göran Andersson" <guffa@guffa.co m> wrote in message
          >> news:u3xqDEskGH A.1204@TK2MSFTN GP02.phx.gbl...[color=darkred]
          >>> Why do you post VB code in the C# newsgroup? Only post in the relevant
          >>> groups, "pleeeeeeeeeeee eeeeeeeeeeease" .
          >>>
          >>> 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.[/color]
          >>
          >> You are right. I had entered ".doc" instead of "*.doc".
          >>
          >> And I will try and watch where I post more closely.
          >>
          >> Thanks!
          >>[color=darkred]
          >>>
          >>>
          >>> 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(FileType s) 'FileTypes is a string array
          >>>> with stuff like "*.doc" in the arrays
          >>>> ReDim Preserve Watchers(i)
          >>>> Watchers(i) = New FileSystemWatch er
          >>>> With Watchers(i)
          >>>> .Filter = FileTypes(i).To String
          >>>> .EnableRaisingE vents = True
          >>>> .IncludeSubdire ctories = True
          >>>> .InternalBuffer Size = 1277592
          >>>> .NotifyFilter = IO.NotifyFilter s.DirectoryName Or
          >>>> IO.NotifyFilter s.LastWrite Or IO.NotifyFilter s.FileName Or
          >>>> IO.NotifyFilter s.Size Or IO.NotifyFilter s.Attributes
          >>>>
          >>>> 'add handlers
          >>>> AddHandler Watchers(i).Cha nged, AddressOf watch_changed
          >>>> AddHandler Watchers(i).Cre ated, AddressOf watch_changed
          >>>> AddHandler Watchers(i).Del eted, AddressOf watch_changed
          >>>> AddHandler Watchers(i).Ren amed, 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 ".EnableRaising Events = 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. EnableRaisingEv ents 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?[/color]
          >>
          >>[/color]
          >
          >[/color]



          Comment

          Working...