Error copying file or folder in C# - Try/catch statement
Posted on 2009-04-27
I have implemented a try/catch block with C#:
this is what I have -
1) have 2 textboxes and 3 buttons on my form
2) button 1 populates a file name into textbox 1
3) button 2 populates a directory/folder name into textbox 2
4) when both textboxes are filled, button 3 is pressed and the code works great
5) then what I do is I clear the path from textbox1 BUT keep the path in textbox2 and then press button 3 _ I receive appropriate message which tells me that both textboxes must be filled
6) then I clear textbox 2 and fill textbox 1 only, press button 3 and see the following error AFTER which my appropriate message box comes up -any ideas I can't think of anything that could be causing this error:
Error copying file or folder
Cannot copy "my file name here" : The source and destination file names are the same.
any help with this will be greatly appreciated.