Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to use file watcher in c#

private void watch()
{
  FileSystemWatcher watcher = new FileSystemWatcher();
  watcher.Path = path;
  watcher.NotifyFilter = NotifyFilters.LastWrite;
  watcher.Filter = "*.*";
  watcher.Changed += new FileSystemEventHandler(OnChanged);
  watcher.EnableRaisingEvents = true;
}
Comment

c# file watcher

public MainWindow()
{
    InitializeComponent();

    FileSystemWatcher fsw = new FileSystemWatcher();
    fsw.Filter = "test1.csv";
    fsw.NotifyFilter = NotifyFilters.LastWrite;
    fsw.Path = "z:	emp";
    fsw.Changed += Fsw_Changed;
    fsw.EnableRaisingEvents = true;    
}

private void Fsw_Changed(object sender, FileSystemEventArgs e)
{
    MessageBox.Show(e.FullPath);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# convert dictionary object to string 
Csharp :: C# clear console input buffer 
Csharp :: detect collision in unity 
Csharp :: c# kill one excel process 
Csharp :: c# quit button script 
Csharp :: basic of c# sockets 
Csharp :: c# linq select as new object 
Csharp :: append multi lines to file linux 
Csharp :: c# alphabetize a list of string 
Csharp :: test how catch exception c# 
Csharp :: c# Predicate delegate 
Csharp :: convert int32 
Csharp :: check if palindrome recursion in c# 
Csharp :: c# regex find last match 
Csharp :: unity onclick object 
Csharp :: How to post request C# with returning responsebody 
Csharp :: string to char array c# 
Csharp :: C# fileinfo creation date 
Csharp :: meaning immutable and mutable 
Csharp :: primitive types c# 
Csharp :: get number of days between two dates c# 
Csharp :: array declaration in c# 
Csharp :: linq find object from id 
Csharp :: c# wpf row definition height * in code 
Csharp :: c# dictionary with dictionary as value 
Csharp :: change line color in c# 
Csharp :: c# obsolete class 
Csharp :: for jump script unity 2d 
Csharp :: convert path to uri c# 
Csharp :: how to get the today date in c# 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =