Hello all, I have spend a day or so seeking a solution through this but I can not find code which matches so am seeking some help to modify my code here as I need to be able to add progress to a Timer which is Timer2. any help much appreciated.
Code:
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Dim buffer(1023) As Byte
Dim bytesIn As Integer
Dim output As IO.Stream
Dim setupRequest As System.Net.FtpWebRequest = DirectCast(System.Net.FtpWebRequest.Create("ftp://myfilename.zip"), System.Net.FtpWebRequest)
setupRequest.Credentials = New System.Net.NetworkCredential("user", "password")
setupRequest.Method = System.Net.WebRequestMethods.Ftp.DownloadFile
Dim ftpResponse As System.Net.FtpWebResponse = DirectCast(setupRequest.GetResponse(), FtpWebResponse)
Dim ftpStream As Stream = ftpResponse.GetResponseStream()
output = System.IO.File.Create("d:\ftp.zip")
bytesIn = 1
Do Until bytesIn < 1
bytesIn = ftpStream.Read(buffer, 0, 1024)
If bytesIn > 0 Then
output.Write(buffer, 0, bytesIn)
Application.DoEvents()
End If
Loop
output.Close()
ftpStream.Close()
End Sub