1

I'm using WinForms. In my form i have a button. When i press that button i want to copy a Tif image to another location and name it display.tif. I've browsed the internet for solutions but they all say use "Fil.copy()" so i tried that and it keeps giving me an error.

This is my code below:

    private void Display_Button_Click(object sender, EventArgs e)
    {

        File.Copy(@"â€ĒC:\image\Source_File\Display.tif", @"C:\image\Source_File\Destination_File\display.tif", true);

    }

and this is the error which i keep on getting. Why do i have this error?

enter image description here

Something Interesting i discovered:

It seems like when you copy and paste the directory from the file properties the code doesn't recognize it even though all the letters look the same. I had to hand write the file path to make it work properly. (right click on the file - the properties should be at the bottom)enter image description here

taji01
  • 2,527
  • 8
  • 36
  • 80
  • Are you sure the destination path is **C:\image\Source_File\Destination_File\display.tif** and not **C:\image\Destination_File\display.tif** ? – Bharat Gupta Jun 04 '16 at 08:19
  • yes, I am positive. If you copy and paste the path sometimes the code doesn't like it. I found that out the hard way. You have to write the code out manually sometimes. – taji01 Jun 04 '16 at 16:52
  • This might help you: http://stackoverflow.com/questions/24856821/what-is-causing-notsupportedexception-the-given-paths-format-is-not-supported – Ulric Jun 06 '16 at 10:08

0 Answers0