'Set the backup button as disabled btnbackup.Enabled = False
Try 'set the Title of a Openfolder Dialog Box OFD.Title = "Please MS Access Database File" 'Set a specific Filter and Index OFD.Filter = "MS Access Database Files (*.mdb)|*.accdb" OFD.FilterIndex = 1 ' when the Browse Image button is click it will open the OpenfileDialog 'this line of will check if the dialogresult selected is cancel then If OFD.ShowDialog <> Windows.Forms.DialogResult.Cancel Then 'Set the location txtlocation.Text = OFD.FileName End If Catch ex As Exception 'catch some error that may occur End Try
' it Disable the Backup button when the location is empty else do the opposite If txtlocation.Text = "" Then btnbackup.Enabled = False Else btnbackup.Enabled = True End If
Try 'call the SavefileDialog box SFD.ShowDialog() 'Set the title SFD.Title = "Save File" 'Set a specific filter SFD.Filter = "(*.mdb)|*.accdb" If SFD.ShowDialog = Windows.Forms.DialogResult.OK Then 'set the destination of a file txtDestination.Text = SFD.FileName Dim portfolioPath As String = My.Application.Info.DirectoryPath 'create a backup by using Filecopy Command to copy the file from location to destination 'Reload the form Call Form1_Load(sender, e) txtlocation.Text = Nothing txtDestination.Text = "Destination..." End If Catch ex As Exception 'catch some error that may occur End Try