0

Hi I am trying to create a c# window forms application (using Framework 3.5), what application will have is some shared data on .txt file where my application should be invoked (or receive some message) if there is any update to the .txt file. My requirement is in Windows Forms, any suggestions would be helpful.

rahul
  • 3
  • 1

3 Answers3

2

You can use the FileSystemWatcher class for this.

BrokenGlass
  • 158,293
  • 28
  • 286
  • 335
  • If you go this route make sure you give this question a quick read [FileSystemWatcher Fails to access network drive.](http://stackoverflow.com/questions/960318/filesystemwatcher-fails-to-access-network-drive) – Brian Apr 25 '11 at 14:45
1

If I understand you correctly, what you want is just a process running with a file updated event handler that runs your winform app.

The FileSystemWatcher class is what you need for the file update events. http://www.dotnetforce.com/Content.aspx?t=a&n=200

Filip
  • 51
  • 1
  • 4
1

I'd suggest using Named Pipes

Interprocess Communication using Named Pipes in C#

Brian
  • 4,974
  • 2
  • 28
  • 30
  • Instead of a shared .txt file, you mean? – Justin Apr 25 '11 at 14:42
  • Ideally yes, I'd suggest using Named Pipes instead of a shared flat file. However I don't know what restrictions are on the other end in regards to modifying the existing app to use Named Pipes as well. I just hate seeing new development getting pulled down by "making things fit" with older apps instead of updating to accommodate new requirements. – Brian Apr 25 '11 at 14:54