ashk1860

hi

I need to create a watcher to rase a custom event if the size of the file changed. but I don't know the most efficient way to watch. the only way that I can imagin is to use a timer to check in a time period!!!!

thank you in advance

regards



Re: Visual C# General watch if the file size change

Karthikeya Pavan Kumar .B

You can check this Watching a File in C#






Re: Visual C# General watch if the file size change

Matthew Watson

You can use a FileSystemWatcher to raise an event when the size of a file has changed. See FileSystemWatcher.NotifyFilter for the setting to use.

Beware! FileSystemWatcher raises the event on a separate thread, so you can't directly access any UI Controls from the event handler code. You'd have to use form.BeginInvoke() or form.Invoke() to transition to the UI thread.




Re: Visual C# General watch if the file size change

ashk1860

thank you for your swift and helpful answers