[go: up one dir, main page]

0% found this document useful (0 votes)
10 views1 page

Complete-Reference-Vb Net 52

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Complete-Reference-Vb Net 52

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

FileSystemWatcher

NotifyFilters

Changes to watch for in a file or folder are specified by constants of the NotifyFilters enumeration and set to
the NotifyFilter property. Like the constants of the file mode, access, and attributes enumerations, this
enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values. In other
words, you can combine constants to watch for more than one kind of change. For example, you can watch for
changes in the size of a file or a folder, and for changes in security settings. The combination raises an event
anytime there is a change in size or security settings of a file or folder.

Table 15−21 lists the constants of the NotifyFilters enumeration.

Table 15−21: Members of the NotifyFilters Enumeration

Member Purpose
Attributes Represents the attributes of the file or folder
CreationTime Represents the time the file or folder was created
DirectoryName Represents the name of the directory
FileName Represents the name of the file
LastAccess Represents the date the file or folder was last opened
LastWrite Represents the date the file or folder last had anything written to it
Security Represents the security settings of the file or folder
Size Represents the size of the file or folder
Use these filter constants to specify the constant or constant combinations to watch. To watch for changes in
all files, set the Filter property in the object to an empty string (""). If you are watching for a specific file,
then set the Filter property to the filename as follows:

Watcher.Filter = "noisefile.txt"

To watch for changes in all text files, simply set the Filter property as follows:

Watcher.Filter = "*.txt"

By the way, hidden files are not ignored.

WatcherChangeTypes

Changes to watch for that may occur to a file or folder are specified by constants of the
WatcherChangeTypes enumeration and set to the event hanlder. This enumeration also has a FlagsAttribute
attribute decorating it that allows the CLR to reference bitwise combinations of its member values. Each of
the WatcherChangeTypes constants is associated with an event in FileSystemWatcher. The constant
members of this enumeration are listed in Table 15−22.

Table 15−22: The Constants of the FileSystemWatcher Enumeration

Member Description
All Fires on the creation, deletion, change, or renaming of a file or folder

536

You might also like