Oppure

Loading
Questo topic e' stato chiuso dal moderatore.
27/05/15 13:34
fosforo
Ciao
Ho trovato questo codice nel sito Microsoft per monitorare una cartella:

private void watch()
{
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = FilePath;
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
watcher.Filter = "*.*";
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.EnableRaisingEvents = true;
}

private void OnChanged(object source, FileSystemEventArgs e)
{
textBox4 .Text = (e.FullPath );
}

Quando metto nella cartella un file mi va in errore:
System.InvalidOperationException non è stata gestita

Grazie anticipatamente.
aaa
28/05/15 9:43
fosforo
Risolto con:

this.textBox.Invoke(new MethodInvoker(() => this.textBox4.Text ="stringa";));
aaa