|
-
Mar 24th, 2004, 03:52 PM
#1
Thread Starter
Member
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
-
Mar 24th, 2004, 04:07 PM
#2
Frenzied Member
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
-
Mar 25th, 2004, 07:07 AM
#3
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|