It's because you use string.Format with {#}'s in the string and then do not provide them as arguments.
Go back to your original example and set
Then use the debugger to see the value assigned to PIOutput and post it here (or examine it and figure out why it's an invalid path).Code:string PIOutput = string.Format("{0}{1}Metdata_MT-{2:yyyy-MM-dd}.txt", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Path.DirectorySeparatorChar, DateTime.Now)




Reply With Quote