Try
Dim backupdate, newname As String
backupdate = DateString
newname = "C:\backup\dbase" & "" + backupdate + "" & ".mdf"
If System.IO.File.Exists(newname) Then
System.IO.File.Delete(newname)
System.IO.File.Copy(Application.StartupPath & "\db\dbase.mdf", newname)
Else
System.IO.File.Copy(Application.StartupPath & "\db\dbase.mdf", newname)
End If
Dim mymsg As New myMsgbox
With mymsg
.txtError.Text = "Database Backup Successful!"
.ShowDialog()
End With
Catch ex As Exception
Dim mymsg As New myMsgbox
With mymsg
.txtError.Text = "Error Backing Up Database, try again later!"
.ShowDialog()
End With
End Try