I hope it helps you, It is a sub proceedure with with a file open dialog object called "ofd" and the event object is called "cmdcopy" the text on the cmdcopy object is "Copy".
I leave you to fiddle with the snippet.
Private Sub cmdcopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcopy.Click
[INDENT]
ofd.ShowDialog()
Dim filetocopy As String
Dim stlen As Integer
filetocopy = ofd.FileName
Dim ext As String
'filetocopy.Trim()
Trim(filetocopy)
Dim position As Integer
' We first try to get the index of the "." symbol in the string
position = InStr(filetocopy, ".")
stlen = filetocopy.Length
ext = filetocopy.Substring(position - 1, (stlen - position) + 1)
'Dim check As Boolean
' Dim location As String
Dim newfile As String = "c:\newfile78" & ext ' At this point i choose to declare a file
If File.Exists(newfile) = True Then
Dim overwrite As Integer
overwrite = MessageBox.Show("Do you want to overwrite the existing file", "Overwrite file?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If overwrite = vbYes Then
File.Delete(newfile)
File.Copy(filetocopy, newfile)
MessageBox.Show("Successfully Copied" & vbNewLine & filetocopy & "to" & newfile)
ElseIf overwrite = vbNo Then
Exit Sub
End If
End If
File.Copy(filetocopy, newfile & ext)
MessageBox.Show("Successfully Copied" & vbNewLine & filetocopy & "to" & newfile)
End Sub
[/INDENT]