0

Hey,

i'm trying to have 2 browse file dialog boxes, one that allows you to select a file from a folder, and the other folder should allow you to chose the location to copy the file to.

Thanks

3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by zakeer.ms
0

Hey,

i'm trying to have 2 browse file dialog boxes, one that allows you to select a file from a folder, and the other folder should allow you to chose the location to copy the file to.

Thanks

Hi You want to use an OpenFileDialog box for the Selection and a SaveFileDialog box for the destination. Then you copy the source file to the destination:

Private Sub CopyFile()
dim sSource as string
dim sDestination as string
dim diaSrc as new OpenFileDialog
'set up open file
with diaSrc
     .Title = "Browse to Document"
      .InitialDirectory = "C:\"
      .Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
      .RestoreDirectory = True
end with

if diaSrc.showdialog = Windows.Forms.DialogResult.OK Then
   sSource = diaSrc.fileName
end if
'do the same with the destination on a savefiledialog....
'......

if file.exists(sDestination) Then 
   file.delete(sDestination)
end if
file.copy(sSource, sDestination)
end sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.