By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,678 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,678 IT Pros & Developers. It's quick & easy.

FileSystemWatcher: How to distinguish between different change eve

P: n/a
Hi,

I am using FileSystemWatcher like this:

fsw = New IO.FileSystemWatcher(strPath, strFilename)
fsw.NotifyFilter = NotifyFilters.Size or NotifyFilters.LastWrite
fsw.EnableRaisingEvents = True

This raises two events when saving file.

Saving changes with notepad with or _without_ changing in size also raises
two times.

Using

fsw.NotifyFilter = NotifyFilters.Size

doesn't raise the change event, wenn saving, but not changing size.

Is there a way to find out, whether size has changed and/or date/time has
changed?

Thanks in advance

Klaus
Dec 6 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Dec 6, 4:51 pm, Klaus Gollin
<KlausGol...@discussions.microsoft.comwrote:
Hi,

I am using FileSystemWatcher like this:

fsw = New IO.FileSystemWatcher(strPath, strFilename)
fsw.NotifyFilter = NotifyFilters.Size or NotifyFilters.LastWrite
fsw.EnableRaisingEvents = True

This raises two events when saving file.

Saving changes with notepad with or _without_ changing in size also raises
two times.

Using

fsw.NotifyFilter = NotifyFilters.Size

doesn't raise the change event, wenn saving, but not changing size.

Is there a way to find out, whether size has changed and/or date/time has
changed?

Thanks in advance

Klaus
Just check the Event arguments of the change event. Therein, I think,
is an Enum which specifies the type of change.

Dec 6 '07 #2

P: n/a
Thanks for your answer
Just check the Event arguments of the change event. Therein, I think,
is an Enum which specifies the type of change.
That is the problem: debugging the event argument always shows "Change {4}"

Some other ideas?

Klaus
Dec 6 '07 #3

P: n/a
>
That is the problem: debugging the event argument always shows "Change {4}"

Some other ideas?

Klaus
You would find these links useful --

http://msdn2.microsoft.com/en-us/lib...r.changed.aspx
http://msdn2.microsoft.com/en-us/lib...DownFilterText

Hope this helps.
Dec 7 '07 #4

P: n/a
Hi,

thanks for the links but those I already know. The examples are always the
same (and by the way also the ones translated to German), they only handling
the change event without going too deep.

May be someone has a internet source that describes this component more than
scratching on the surface.

Klaus
Dec 7 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.