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

OnChange object of FileSystemWatcher not recognized

The following code:

FileSystemWatcher watcher = new FileSystemWatcher();
RenderingQ =
ConfigurationSettings.AppSettings["RenderingQ"];
watcher.Path = RenderingQ;
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Filter = "*.txt";

// Add event handlers.

watcher.Created += new FileSystemEventHandler(OnChanged);
// Begin watching.
watcher.EnableRaisingEvents = true;
raises the following error:

The name 'OnChanged' does not exist in the current context

So the question is what should I change it to?
Jan 6 '08 #1
2 3025

"pantagruel" <ra*************@gmail.comwrote in message
news:f8**********************************@v29g2000 hsf.googlegroups.com...
The following code:

FileSystemWatcher watcher = new FileSystemWatcher();
RenderingQ =
ConfigurationSettings.AppSettings["RenderingQ"];
watcher.Path = RenderingQ;
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Filter = "*.txt";

// Add event handlers.

watcher.Created += new FileSystemEventHandler(OnChanged);
// Begin watching.
watcher.EnableRaisingEvents = true;
raises the following error:

The name 'OnChanged' does not exist in the current context

So the question is what should I change it to?
You make a method called OnChange so the event is pointing to it. You had
best find out the signature of that particular event, so that the correct
Event Args are passed to the function you need to make manually. Or you can
drop a FileSystemWatch on the form, go to Properties, the Event icon (the
Lightening bolt), Change and give it a name called OnChange to see what is
put there for the code.

You might want to do a GO TO on the InitializeComponent() to see what it put
there for the Control because your += new doesn't look right.

Jan 7 '08 #2
On Jan 7, 5:31 am, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
"pantagruel" <rasmussen.br...@gmail.comwrote in message

news:f8**********************************@v29g2000 hsf.googlegroups.com...
The following code:
FileSystemWatcher watcher = new FileSystemWatcher();
RenderingQ =
ConfigurationSettings.AppSettings["RenderingQ"];
watcher.Path = RenderingQ;
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Filter = "*.txt";
// Add event handlers.
watcher.Created += new FileSystemEventHandler(OnChanged);
// Begin watching.
watcher.EnableRaisingEvents = true;
raises the following error:
The name 'OnChanged' does not exist in the current context
So the question is what should I change it to?

You make a method called OnChange so the event is pointing to it. You had
best find out the signature of that particular event, so that the correct
Event Args are passed to the function you need to make manually. Or you can
drop a FileSystemWatch on the form, go to Properties, the Event icon (the
Lightening bolt), Change and give it a name called OnChange to see what is
put there for the code.

You might want to do a GO TO on the InitializeComponent() to see what it put
there for the Control because your += new doesn't look right.
hmm, found the error, I declared the OnChange method incorrectly.
Shouldn't code at midnight in bed.

Jan 7 '08 #3

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

Similar topics

1
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function...
0
by: Long Tran | last post by:
Hello The DirectoryMonitor sample codes demonstrate the .NET Framework System.IO FileSystemWatcher object works nicely but display only short file name (for example test.bdrg become test~1.bdr)...
1
by: MonkeyBoy | last post by:
I am doing some some HTML manipulation in client-side script (IE5.x and IE6.x browsers only). Something like.. var tmpHTML = oTable.outerHTML // do something to the HTML her oTable.outerHTML =...
2
by: otto | last post by:
I have a form that is used for uploading photos. I have a check box for specifying that the photo being uploaded should appear on a specific web page rather than just be stored in the database for...
1
by: Andreas | last post by:
Hi, we have some problems with the following situation: A remote application A writes files to a directory monitored by a FileSystemWatcher-instance in application B. A creates the file with...
2
by: Ryan Rogers | last post by:
I'm trying to create a FileSystemWatcher Array, however I am new at C#... I know its not instanciating form somereason or not getting the reference because I'm getting the...
4
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is...
0
by: mabra | last post by:
Hi All ! I am fighting with watching a large amount of files for their content and look for some keywords, which indicate dangerous error situations to me. This costs me currently hours each...
21
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.