473,320 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

FileSystemWatcher: How to distinguish between different change eve

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
4 2193
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
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
>
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Stanbrook | last post by:
I'm using the FileSystemWatcher to looks for new files arriving in a directory. Files are coming in via FTP and tend to be larger is size (> 1MB at least). I would like to fire an event once the...
2
by: Paul | last post by:
Hi, I've been developing an application in VB.NET that uses the FileSystemWatcher and a popup notification in order to tell me when files have been downloaded. The FileSystemWatcher code in...
5
by: Jon Maz | last post by:
Hi there, I am experimenting with the FileSystemWatcher object. I have set the NotifyFilter as follows: myFileSystemWatcher.NotifyFilter = NotifyFilters.Security | NotifyFilters.CreationTime...
3
by: Stampede | last post by:
Hi, I write an application which waits for incomming files in a specified directory. I thought, that using the FileSystemWatcher would be the best, as it does exactly what I need. But now I have...
1
by: PadovaBoy | last post by:
Hi! I try to develop a simple system for monitoring a sub directory of a web site and remake an xml file every time a sub-dir change it's name. I don't wont to use a window.service because, i want...
8
by: Pedro C. Valenzuela | last post by:
Hello, Does anyone know how a File System Watcher windows control works to detect file changes accross the network to a remote machine? I am trying to watch for new files in 30 different...
12
by: ljh | last post by:
Has anyone else noticed that the FileSystemWatcher raises the changed event twice when a file is changed? Do you have any idea why this is the case?
5
by: Goran Djuranovic | last post by:
Hi all, I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't...
4
by: hooksie2 | last post by:
Hi, I am trying to use FileSystemWatcher to watch a log file which is written to via a 3rd party app and display the log in listbox on a form. The FileSystemWatch seems to work okay but I get...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.