OpenFileDialog and SaveFileDialog question

Windsailor

Well-known member
Joined
Aug 2, 2006
Messages
45
Programming Experience
1-3
Hello,

What I am thinking about doing is to copy the file selected in the OpenFileDialog form and then use that object to save when I open the SaveFileDialog form and rename it (the same file is saved under a different name and directory).

In the past I have used the File.Copy(filePathOfOriginalFile, "MyFileNameToBeSaved")

But I don't want to hard code the process...

Basically I want to back up a file (MyFileName.here); copy it and then use the SaveFileDialog form to save it in any directory with an alias name... on the flip side... I want to use the OpenFileDialog form, chose the BackUp file that was saved earlier and then save it as the original file's name (MyFileName.here).

So I am backing the file up and then repairing or replace the original file from the backup file.

How can I accomplish this?

Thanks
 
Hello.

The SaveFileDialog and OpenFIleDialog are just Frontends to receive the full path and names of files. Means you're code would look sometzhing like this (more or less pseudo).

VB.NET:
'make backup
If OpenFileDialog.ShowDialog = DialogResult.OK Then
      If SaveFileDialog.ShowDialog = DialogResult.OK Then
            IO.File.Copy(OpenFileDialog.FileName, SaveFileDialog.Filename)
      End If
End If

Bobby
 
Back
Top