I have code which asks the user for a folder path and then copies an MDB file to that folder for back-up. However, the MDB is being copied from the wrong folder. How can I fix it so that it uses the right data folder when backing-up and restoring the MDB?
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
Dim fbd As New FolderBrowserDialog
If fbd.ShowDialog() = vbOK Then
System.IO.File.Copy("MHC.mdb", fbd.SelectedPath & "\MHC.mdb")
MsgBox("Done")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub btnRestore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestore.Click
Try
Dim fbd As New FolderBrowserDialog
If fbd.ShowDialog() = vbOK Then
File.Delete("MHC.mdb")
System.IO.File.Copy(fbd.SelectedPath & "\MHC.mdb", "MHC.mdb")
MsgBox("Done")
Application.Restart()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub