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

Recommended Answers

All 2 Replies

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

Imports System.IO
Nice Article.............

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.