09/06/08 22:46:50
>>242
YES。
ドラッグ&ドロップして、プロパティで、
NotifyFilterをLastWriteにしました。
いまの全コードはこれだけです。
public Form1()
{
InitializeComponent();
this.fileSystemWatcher1.Filter = "tmp.txt";
this.fileSystemWatcher1.NotifyFilter = System.IO.NotifyFilters.LastWrite;
this.fileSystemWatcher1.Path = "C:\\";
}
private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
{
//MessageBox.Show("changed");
string[] lines = System.IO.File.ReadAllLines(file, Encoding.GetEncoding("Shift_JIS"));
label1.Text = lines[1];
label2.Text = lines[2];
label3.Text = lines[3];
label4.Text = lines[4];
label5.Text = lines[5];
}