On my form, I have a ToolStrip that contains a ToolStripLabel that has it's 'Text' property set to "C:\".
When I run the following code, the "diDirectory.GetFiles()" method throws an "Illegal characters in path." exception.
This is what is displayed when I print the label in the Immediate window:
? tsPathLabel.Text
"\"C:\\\""
? tsPathLabel.Text.ToString()
"\"C:\\\""
The text I was expecting is "C:\". Is there a reason that I'm seeing the text above instead of what I was expecting?
tia
flynn
When I run the following code, the "diDirectory.GetFiles()" method throws an "Illegal characters in path." exception.
Code:
DirectoryInfo diDirectory = new DirectoryInfo(tsPathLabel.Text);
FileInfo[] Files = diDirectory.GetFiles(tsFilter.Text);
this.SuspendLayout();
foreach (FileInfo File in Files)
{
ListViewItem lvi = new ListViewItem(new string[] {File.Name, File.Length.ToString() });
listView1.Items.Add(lvi);
}
this.ResumeLayout();
This is what is displayed when I print the label in the Immediate window:
? tsPathLabel.Text
"\"C:\\\""
? tsPathLabel.Text.ToString()
"\"C:\\\""
The text I was expecting is "C:\". Is there a reason that I'm seeing the text above instead of what I was expecting?
tia
flynn