salam,
kat bawah nie ialah satu sistem utuk copy files dari local folder ke shared folder.mcm mane nak refresh filelistbox tu so that setiap kali aku copy certain file ke shared folder,ia kan refresh kat filelistbox.Contohnya lau aku copy file 'a' dari drive c aku ke shared folder bernama zmyxxxxx,after copying,aku nak makesure dalam filelistbox tu , file 'a' tak wujud lagi dah.so takdelah kes user terselect file yg same lagi dah
Private Sub cmdCpy_Click()
Dim path As String
Dim topath As String
Dim File As String
Dim directory As String
On Error GoTo err_handler:
directory = txtdest.Text
File = FileListBox.FileName
path = DirListbox + "\" + File
topath = directory + "\" + File
If txtdest.Text <> "" Then
FileCopy path, topath
MsgBox " file succesfully copied"
Else
MsgBox "please specify target destination"
End If
Kill path
Exit Sub
err_handler:
MsgBox ("Failed. " & Error)
End Sub
Private Sub DirListbox_Change()
FileListBox.path = DirListbox.path
End Sub
Private Sub DriveListBox_Change()
Dim msg As String
Dim result As String
On Error GoTo Error
DirListbox.path = DriveListBox.Drive
Exit Sub
Error: msg = "Error: " & Err.Number & ": " & Err.Description
result = MsgBox(msg, vbOKCancel + vbExclamation, "No Data")
If result = vbOK Then
Resume
Else
DriveListBox.Drive = DirListbox.path
Err.Clear
Exit Sub
End If
End Sub
Private Sub FileListBox_Click()
lblFile.Caption = FileListBox.FileName
End Sub
kat bawah nie ialah satu sistem utuk copy files dari local folder ke shared folder.mcm mane nak refresh filelistbox tu so that setiap kali aku copy certain file ke shared folder,ia kan refresh kat filelistbox.Contohnya lau aku copy file 'a' dari drive c aku ke shared folder bernama zmyxxxxx,after copying,aku nak makesure dalam filelistbox tu , file 'a' tak wujud lagi dah.so takdelah kes user terselect file yg same lagi dah
Private Sub cmdCpy_Click()
Dim path As String
Dim topath As String
Dim File As String
Dim directory As String
On Error GoTo err_handler:
directory = txtdest.Text
File = FileListBox.FileName
path = DirListbox + "\" + File
topath = directory + "\" + File
If txtdest.Text <> "" Then
FileCopy path, topath
MsgBox " file succesfully copied"
Else
MsgBox "please specify target destination"
End If
Kill path
Exit Sub
err_handler:
MsgBox ("Failed. " & Error)
End Sub
Private Sub DirListbox_Change()
FileListBox.path = DirListbox.path
End Sub
Private Sub DriveListBox_Change()
Dim msg As String
Dim result As String
On Error GoTo Error
DirListbox.path = DriveListBox.Drive
Exit Sub
Error: msg = "Error: " & Err.Number & ": " & Err.Description
result = MsgBox(msg, vbOKCancel + vbExclamation, "No Data")
If result = vbOK Then
Resume
Else
DriveListBox.Drive = DirListbox.path
Err.Clear
Exit Sub
End If
End Sub
Private Sub FileListBox_Click()
lblFile.Caption = FileListBox.FileName
End Sub