Results 1 to 3 of 3

Thread: whats wrong with this?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    40

    whats wrong with this?

    I found this example from MS, but my install does not like "OnChanged,OnDeleted,etc words". what am i missing?


    Imports Microsoft.VisualBasic
    Imports System.Diagnostics
    Imports System.IO

    Public Class XmlReadFromURLSample

    Public Shared Sub Main()
    Dim args() As String = System.Environment.GetCommandLineArgs()
    ' If a directory is not specified, exit the program.
    If args.Length <> 2 Then
    ' Display the proper way to call the program.
    Console.WriteLine("Usage: Watcher.exe (directory)")
    Return
    End If

    ' Create a new FileSystemWatcher and set its properties.
    Dim watcher As New FileSystemWatcher
    watcher.Path = args(1)
    ' Watch for changes in LastAccess and LastWrite times, and
    ' the renaming of files or directories.
    watcher.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite Or NotifyFilters.FileName Or NotifyFilters.DirectoryName)
    ' Only watch text files.
    watcher.Filter = "*.txt"

    ' Add event handlers.
    AddHandler watcher.Created, AddressOf OnCreated
    AddHandler watcher.Changed, AddressOf OnChanged
    AddHandler watcher.Created, AddressOf OnChanged
    AddHandler watcher.Deleted, AddressOf OnChanged
    AddHandler watcher.Renamed, AddressOf OnRenamed

    ' Begin watching.
    watcher.EnableRaisingEvents = True

    ' Wait for the user to quit the program.
    Console.WriteLine("Press 'q' to quit the sample.")
    While Chr(Console.Read()) <> "q"c
    End While

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Doesn't look like you have the methods OnChanged etc. in that code - I took a look at their example and it looks like you didn't copy and paste the entire example.

    Mike

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2003
    Posts
    40

    Red face Yep

    After I posted I realized what you are saying. Im learning something new here and assumed OnDemand.etc was a method

    Thanks for the reply

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width