此主题相关图片如下:2.jpg

以下代码是窗口的AfterLoadg事件代码,想实现本地电脑的附件文件与FTP上的文件同步(FTP连接没有问题),且在同步时显示同步了哪些文件,并用进度条显示同步进度。但以下代码只有同步完最后一个文件时才显示,请老师帮忙!!拜谢!
'''
Dim lb1 As WinForm.Label = e.Form.Controls("Label1")
Dim btn As WinForm.Button = e.Form.Controls("Button1")
btn.Visible = False
Dim pros As WinForm.ProgressBar = e.Form.Controls("ProgressBar1")
pros.Minimum = 1
pros.Value = 1
Dim ftp As New FTPClient '定义FTP客户端
ftp.Host="*******" 'ip地址
ftp.Account = "****" '用户名
ftp.Password = "****" '密码
ftp.RootDir = "/儿童附件/"
pros.Maximum = ftp.GetFileList.Count + 1
For Each fl As String In ftp.GetFileList
If FileSys.FileExists(ProjectPath & "RemoteFiles\" & fl) = False Then
Application.DoEvents
lb1.Text = "正在同步:" & fl
ftp.Download(fl,ProjectPath & "RemoteFiles\" & fl)
End If
pros.Value = pros.Value +1
Next
btn.Visible = True