Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DownLoadFile Problem

Status
Not open for further replies.

kennedymr2

Programmer
May 23, 2001
594
AU
Using wc As New System.Net.WebClient()

Try
wc.DownloadFile(Server1 & FileName4, Filename3)
AddHandler wc.DownloadProgressChanged, AddressOf pchanged
AddHandler wc.DownloadFileCompleted, AddressOf done
Catch ex As WebException
' MsgBox(ex.ToString)
End Try

End Using


Do While DoneX = False
System.Windows.Forms.Application.DoEvents()
Loop


Sub done(ByVal sender As Object, ByVal e As System.ComponentModel.AsyncCompletedEventArgs)

If e.Error Is Nothing Then
'MsgBox("Download completed!")
Else
'MsgBox(e.Error.Message)
End If

DoneX = True

End Sub

When i carry out the above functions in most cases it works 100% .. but on just a few files the donex does not get set to True......

When i look at the file in the output directory it is there but shows 0 size.... if i open the file in notepad there is data in there...if i completely close the program ie stop debugging......the file size does then shows up as eg 18kb..

On small files i do not have the problem, its only in larger files.

Appreciate any ideas

Regards Kennedymr2

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top