I made a program in which I want to copy a file from one folder to another. But I want to name that file from textbox. I am using below code. Please help me
FileInfo receipt = new FileInfo(@"C:\ssds\Receipt.xml");
receipt.CopyTo(@"C:\");
MessageBox.Show("XML Is created");
In receipt.CopyTo I need to write the name from the text box.
If it’s just adding a filename then use string.Format
or stringConcat
if it may contain parts of paths or absolute paths (in the case you use some SaveFileDialog), then Darin’s answer using Path class is what you need