[Solved] the given path’s format is not supported. c#


Here you use the correct way of formatting the path in Windows with a Backslash

ofd.InitialDirectory = @"C:\Picture";

And in the next line you divert from it

System.IO.File.Copy(ofd.FileName, "/Resources/SImages/" + lblRNo.Text + ".jpg");

just keep the way you did it in the beginning:

System.IO.File.Copy(ofd.FileName, @"\Resources\SImages\" + lblRNo.Text + ".jpg");

One way of avoiding such irritations is to use System.IO.Path.Combine()

string path = System.IO.Path.Combine("Resources", "SImages");

EDIT: due to the extraordinary observation by Steve I changed lblRNo to lblRNo.Text

solved the given path’s format is not supported. c#