0

Is it possible to directly bind a Windows GUI component (like a RichTextBox) to display (read-only) the contents of a file that is being appended by another process? I.e., so if something new is written to the file the component would display that new content?

What's the most straightforward way of doing it in C++/C#/CLR? Given that this is not an uncommon task I'm wondering if there is something easier than setting up a FileSystemWatcher and then on callback doing all the plumbing and synchronizing between the file and the GUI component's buffer.

feetwet
  • 3,248
  • 7
  • 46
  • 84
  • http://stackoverflow.com/questions/721714/notification-when-a-file-changes – Alexander Balabin Jul 02 '15 at 18:17
  • also http://stackoverflow.com/questions/3517460/is-there-anything-like-inotify-on-windows – ficuscr Jul 02 '15 at 18:20
  • Yes, FileSystemWatcher is part of the kludge I had suggested, and hoped to avoid. I.e., I'm expecting and asking whether there are already components that can be bound to an open file so I don't have to run a Watcher and plumb the changes into the component. – feetwet Jul 02 '15 at 18:21

1 Answers1

1

Using System.IO.FileSystemWatcher you can get events telling you when the file is updated, then you re-read the file and update your control.

Alexander Balabin
  • 2,055
  • 11
  • 13