Note that there are some explanatory texts on larger screens.

plurals
  1. POThe path is not of a legal form
    primarykey
    data
    text
    <p>When I try to run this application it says:"The path is not of a legal form.". It's a warning and it says there is something wrong with:"fileSystemWatcher1.IncludeSubdirectories = true;" when I click on browse. When i click on browse for the 2nd filewatcher it does exactly the same. ( I have 2 browse buttons to watch 2 directories ) I gave the filewatchers no starting path but when i do give them a starting path, it works. I dont want that. Please help me.</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; namespace WindowsFormsApplication1 { public partial class Form1 : Form { private bool pause = false; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { } // The lines with performed actions of a file private void fileSystemWatcher1_Created(object sender, System.IO.FileSystemEventArgs e) { if (!pause) { listBox1.Items.Add("File Created&gt; " + e.FullPath + " -Date:" + DateTime.Now); } } private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e) { if (!pause) { listBox1.Items.Add("File Changed&gt; " + e.FullPath + " -Date:" + DateTime.Now); } } private void fileSystemWatcher1_Deleted(object sender, System.IO.FileSystemEventArgs e) { if (!pause) { listBox1.Items.Add("File Deleted&gt; " + e.FullPath + " -Date:" + DateTime.Now); } } private void fileSystemWatcher1_Renamed(object sender, System.IO.RenamedEventArgs e) { if (!pause) { listBox1.Items.Add("File Renamed&gt; " + e.FullPath + " -Date:" + DateTime.Now); } } private void fileSystemWatcher2_Changed(object sender, System.IO.FileSystemEventArgs e) { if (!pause) { listBox1.Items.Add("File Changed&gt; " + e.FullPath + " -Date:" + DateTime.Now); } } private void fileSystemWatcher2_Created(object sender, System.IO.FileSystemEventArgs e) { if (!pause) { listBox1.Items.Add("File Created&gt; " + e.FullPath + " -Date:" + DateTime.Now); } } private void fileSystemWatcher2_Deleted(object sender, System.IO.FileSystemEventArgs e) { if (!pause) { listBox1.Items.Add("File Deleted&gt; " + e.FullPath + " -Date:" + DateTime.Now); } } private void fileSystemWatcher2_Renamed(object sender, System.IO.RenamedEventArgs e) { if (!pause) { listBox1.Items.Add("File Renamed&gt; " + e.FullPath + " -Date:" + DateTime.Now); } } //1st directory private void button2_Click(object sender, EventArgs e) { fileSystemWatcher1.IncludeSubdirectories = true; DialogResult resDialog = dlgOpenDir.ShowDialog(); if (resDialog.ToString() == "OK") { fileSystemWatcher1.Path = dlgOpenDir.SelectedPath; textBox1.Text = dlgOpenDir.SelectedPath; } } //2nd directory private void button3_Click(object sender, EventArgs e) { fileSystemWatcher2.IncludeSubdirectories = true; DialogResult resDialog = dlgOpenDir.ShowDialog(); if (resDialog.ToString() == "OK") { fileSystemWatcher2.Path = dlgOpenDir.SelectedPath; textBox2.Text = dlgOpenDir.SelectedPath; } } //log private void button1_Click(object sender, EventArgs e) { DialogResult resDialog = dlgSaveFile.ShowDialog(); if (resDialog.ToString() == "OK") { FileInfo fi = new FileInfo(dlgSaveFile.FileName); StreamWriter sw = fi.CreateText(); foreach (string sItem in listBox1.Items) { sw.WriteLine(sItem); } sw.Close(); } } //pause watching private void pause_button_Click(object sender, EventArgs e) { if (!pause) { pause = true; pause_button.Text = "Unpause"; } else { pause = false; pause_button.Text = "Pause Watching"; } } //clear listbox private void clear_button_Click(object sender, EventArgs e) { listBox1.Items.Clear(); } } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload