Code Copy and Move File di Visual Basic 6.0

Pagi ini saya suguhkan source code untuk pemrograman pada Visual Basic 6.0, disini saya akan berikan contoh Code Copy and Move File di Visual Basic 6.0, mungkin teman-teman sudah sangat jago dengan Visual Basic. tapi tidak salahkan jika saya hanya ingin berbagi. hehe...
Seperti ini codenya bisa sesuaikan dengan komponen yang dibuat oleh teman-teman :


Private Declare Function CopyFile Lib "kernel32" Alias _
"CopyFileA" (ByVal lpExistingFileName As String, ByVal _
lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Private Declare Function MoveFile Lib "kernel32" Alias _
"MoveFileA" (ByVal lpExistingFileName As String, ByVal _
lpNewFileName As String) As Long
Sub CopyMove()
Dim strSource As String
Dim strTarget As String
Dim lngRetVal As Long
strSource = "C:\Myfile.txt"
strTarget = "D:\MyFolder\Myfile.txt"
'// Copy File
lngRetVal = CopyFile(Trim$(strSource), Trim(strTarget), True)
If lngRetVal Then
MsgBox "File copied!"
Else
MsgBox "Error. File not moved!"
End If
'// Move File
lngRetVal = MoveFile(Trim$(strSource), Trim(strTarget))
If lngRetVal Then
MsgBox "File moved!"
Else
MsgBox "Error. File not moved!"
End If
End Sub
 
Sekian saja. Terimakasih

0 Response to "Code Copy and Move File di Visual Basic 6.0 "

Posting Komentar

amazon

Entri Populer