Jumat, 24 Februari 2012

Program Tambahan Visual Basic Bagian 6 : Backup Database


Posted in VISUAL BASIC on Juli 21, 2009 by OPIX HOLMES
Saat ini kita belajar bagaimana cara membuat program untuk membackup atau menyalin database.

1. Buat sebuah form baru.
2. Masukanlah objek objek berikut ini ke dalam form tersebut :
NAME
CAPTION
TOOL
Frame1File SumberFrame
Frame2Direktori TujuanFrame
Drive1
-
DriveListBox
Drive2
-
DriveListBox
Dir1
-
DirListBox
Dir2
-
DirListBox
File1
-
FileListBox
Label1Direktori AsalLabel
Label2Direktori TujuanLabel
Text1
-
TextBox
Text2
-
TextBox
CmdCopyCopy FileCommandButton

3. Listing Program :
Private Declare Function SHFileOperation Lib "Shell32.dll" Alias "SHFileOperationA" (lpFileOP As shfileopstruct) As Long
Private Const FO_copy = &H2
Private Const fof_allowundo = &H40

Private Type shfileopstruct
hwnd As Long
wfunc As Long
pfrom As String
pto As String
Fflags As Integer
Faborted As Boolean
hnamemaps As Long
sprogress As String
End Type

Public Sub copy(ByVal asal As String, ByVal tujuan As String)
Dim X As shfileopstruct
With X
.hwnd = 0
.wfunc = FO_copy
.pfrom = asal & vbNullChar & vbNullChar
.pto = tujuan & vbNullChar & vbNullChar
.Fflags = fof_allowundo
End With
SHFileOperation X
End Sub

Private Sub CMDCOPY_Click()
On Error Resume Next
copy Text1.Text, Text2.Text
End Sub

Private Sub Command1_KeyPress(Keyascii As Integer)
If Keyascii = 27 Then Unload Me
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub Drive2_Change()
Dir2.Path = Drive2.Drive
End Sub

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Dir2_Change()
Text2.Text = Dir2.Path
End Sub

Private Sub File1_Click()
Text1.Text = File1.Path & "\" & File1.FileName
End Sub




(This science taken from some sources)
OPIX HOLMES
opix.holmes@yahoo.com
www.islamicunderground.wordpress.com

VBT6 BACKUP DATABASE

Tidak ada komentar:

Posting Komentar