Imports SMOObject = [Link] Imports [Link] Public Class frmBackupRestore Dim backup As [Link] Dim restore As SMOObject.
Restore Private Sub frmBackupRestore_Load(ByVal sender As [Link], _ ByVal e As [Link]) Handles [Link] [Link] = False [Link] = [Link] [Link] = [Link] [Link] = [Link] [Link] = [Link] End Sub Private Sub btnBackup_Click(ByVal sender As [Link], _ ByVal e As [Link]) Handles [Link] If [Link] = [Link] Then MsgBox("Nama file belum diisi") Exit Sub End If If [Link]("Backup database?", _ "Konfirmasi", [Link]) = _ [Link] Then Exit Sub Cursor = [Link] [Link] = True Try '//buat backup device nya Dim bdi As New [Link] [Link] = [Link] [Link] = [Link] '//buat object backup backup = New [Link] [Link] = [Link] '//notifikasi untuk progress bar tiap 10% [Link] = 10 [Link](bdi) [Link] = True '//associate event percent complete '//dengan add handler nya untuk '//refresh progress bar value AddHandler [Link], _ AddressOf BackupPercentComplete AddHandler [Link], _ AddressOf BackupComplete Dim server As New [Link]([Link])
[Link](server) Catch ex As Exception [Link] = False MsgBox([Link]) Finally Cursor = [Link] End Try End Sub Private Sub btnBackupLocation_Click(ByVal sender As [Link], _ ByVal e As [Link]) Handles [Link] If [Link] = _ [Link] Then [Link] = [Link] End If End Sub Private Sub btnRestore_Click(ByVal sender As [Link], _ ByVal e As [Link]) Handles [Link] If [Link] = [Link] Then MsgBox("Nama file belum diisi") Exit Sub End If If [Link]("Apakah backup akan di restore?", _ "Konfirmasi", [Link]) = _ [Link] Then Exit Sub Cursor = [Link] [Link] = True Try '//buat backup device nya '//tentukan nama file .bak '//set ke file device type, karena tipe device '//yang digunakan disini yaitu file Dim bdi As New [Link] [Link] = [Link] [Link] = [Link] restore = New [Link] [Link] = [Link] [Link] = [Link] [Link] = 10 [Link] = True [Link] = True [Link](bdi) '//associate event percent complete '//dengan add handler nya untuk '//refresh progress bar value AddHandler [Link], _ AddressOf RestorePercentComplete AddHandler [Link], _ AddressOf RestoreComplete Dim server As New [Link]([Link])
[Link](server) Catch ex As Exception [Link] = False MsgBox([Link]) Finally Cursor = [Link] End Try End Sub Private Sub btnRestoreLocation_Click(ByVal sender As [Link], _ ByVal e As [Link]) Handles [Link] If [Link] = _ [Link] Then [Link] = [Link] End If End Sub Private Sub BackupPercentComplete(ByVal sender As [Link], _ ByVal e As [Link]) '//update progress bar value '//dan text label info [Link] = [Link] [Link] = "Backup Progress " & [Link] & " %" [Link]() End Sub Private Sub BackupComplete(ByVal sender As [Link], _ ByVal e As ServerMessageEventArgs) '//hapus handler dari event nya RemoveHandler [Link], _ AddressOf BackupPercentComplete RemoveHandler [Link], _ AddressOf BackupComplete [Link] = [Link] [Link] = 0 [Link] = False Cursor = [Link] End Sub Private Sub RestorePercentComplete(ByVal sender As [Link], _ ByVal e As [Link]) '//update progress bar value '//dan text label info [Link] = [Link] [Link] = "Restore Progress " & [Link] & " %" [Link]() End Sub Private Sub RestoreComplete(ByVal sender As [Link], _ ByVal e As ServerMessageEventArgs) '//hapus handler dari event nya RemoveHandler [Link], _ AddressOf RestorePercentComplete RemoveHandler [Link], _
AddressOf RestoreComplete [Link] = [Link] [Link] = 0 [Link] = False Cursor = [Link] End Sub End Class