Using FileWatch?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all!
This is what I want to do, looking the for the best way to do this.
I have a text file that gets created and placed in a folder. I would like to
have a watch for that file when it pops in that folder. But I would alway
like to have the watch active. I don't want it at Form Load, and I can't
have a button get clicked. I just would like to have when ever that file gets
put in that folder, it performs my next step. I'll be staying on one form.
How would I write this?

Thanks!

Rudy
 
Hello Rudy,

See FileSystemWatcher class in MSDN, there are several samples.
This class automatically raise an event when directory/file in a directory
changes

Just create app that will be located into tray area and notify u on each
file change

R> Hello all!
R> This is what I want to do, looking the for the best way to do this.
R> I have a text file that gets created and placed in a folder. I would
R> like to
R> have a watch for that file when it pops in that folder. But I would
R> alway
R> like to have the watch active. I don't want it at Form Load, and I
R> can't
R> have a button get clicked. I just would like to have when ever that
R> file gets
R> put in that folder, it performs my next step. I'll be staying on one
R> form.
R> How would I write this?
R> Thanks!
R>
R> Rudy
R>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Thanks Michael!

I did look at the documetnation, but still couldn't get it to work right.
Then I saw there is a component of FileWatch, I set that up, works fine.
 
Actually, everything doesn't work fine. My watch works well, Thank you
Michael. But that text file that is being created is coming from a SQL
trigger. when the trigger runs more than once in the same session I get a
"The process can not acess the file because it's being used by another
process"
This is refering to my text file. If I run the trigger without my app, it
works fine.
What do I need to do so I can run this trigger more than once in the same
session, is there a way to refresh the process or something? FYI I'm using
VS 2003, SQL 2000.
I'm hope this make sence to somebody, cause it sure doesn't make sence to me.
LOL

TIA!!

Rudy
 
Back
Top