473,288 Members | 1,704 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,288 software developers and data experts.

C# FileSystemWatcher Problem

Hi,

I'm trying to do this:

private void SetNF(FileSystemWatcher fsw,int val){
if( (val&4)!=0 )
fsw.NotifyFilter |= System.IO.NotifyFilters.Attributes;
// i'v tried this also:
// if( (val&4)!=0 )
fsw.NotifyFilter = System.IO.NotifyFilters.Attributes;
}

and i get this EXCEPTION:
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll

Additional information: The path is not of a legal form.
Please Help.
Nov 16 '05 #1
1 6408
Try this

//I assume you want to add this new filter to your existing filters on
// the fileSystemWatcher
private void SetNF(FileSystemWatcher fsw, NotifyFilters filter)
{
fsw.NotifyFilter |= filter;
}

Let me know if this is not what you are trying to do, note that to check
if a filter has been set in the FSW the code would be as below

For e.g. if you want to check if the attribute filter is set

if( (fsw.NotifyFilter & NotifyFilters.Attribute) == NotifyFilters.Attribute)
attributeFilterSet = true;
else
attributeFilterSet = false;

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

eyal wrote:
Hi,

I'm trying to do this:

private void SetNF(FileSystemWatcher fsw,int val){
if( (val&4)!=0 )
fsw.NotifyFilter |= System.IO.NotifyFilters.Attributes;
// i'v tried this also:
// if( (val&4)!=0 )
fsw.NotifyFilter = System.IO.NotifyFilters.Attributes;
}

and i get this EXCEPTION:
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll

Additional information: The path is not of a legal form.
Please Help.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Josh Usovsky | last post by:
I'm setting up a watched folder using FileSystemWatcher. When I drop a small file into the watched folder, I can respond to a .Created event and process the file with other code. However, if I try...
0
by: cxw0106 | last post by:
Hello, I have some weird problem with the FileSystemWatcher. I have developed an application that monitors a network directory for file changes of a certain file type. The program runs well for...
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...
7
by: Allen Anderson | last post by:
I'm trying to figure out a way to catch when a file has been written to a directory. I currently have it where I can catch when the file begins writing, but this isn't helpful as I need to know...
13
by: David | last post by:
I have been working on trying to write a directory watcher service. One of the requirments is that it be able to watch multiple directories, not sub directories of one parent directory, but just...
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...
20
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
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...
2
by: kmcnet | last post by:
Hello Everyone and thanks for your help in advance. I have been battling a problem for nearly a month with the FileSystemWatcher component. Basically, what I am trying to do it to monitor three...
5
by: =?Utf-8?B?Sm9obiBT?= | last post by:
I am trying to find out if there is a way to tell if there is already a filesystemwatcher (created by a webservice) monitoring a folder. I have a webservice that creates a filesystemwatcher,...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...

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.