Hi,
foreach (ListViewItem item in listViewFiles.Items)
{
MessageBox.Show(item.SubItems[0].Text + ", " + item.SubItems[1].Text);
string source=item.SubItems[0].Text;
string destination=item.SubItems[1].Text;
File.Copy(source,destination,true);
item.SubItems[2].Text="Success";
}
In this snippet, when I retrieve the text from the listview it looks
fine in the MessageBox. It looks exactly like my xmlFile that holds
the data. I had a MessageBox on the strings there too and it looked
fine.
However, when I run it I get an error about the path not being right.
I put a breakpoint on the File.Copy method and when I hover over the
variables source and destination, it has this:
\r\nC:\mysource\r\n
\r\nC:\mydest\r\n
Where did the extra \r\n come from? How do I get rid of them? Thank
for any help.