Robby
Ultimate Contributor
The following code goes to a url, reads the source and if all is
good, it then downloads an image from that server(site).
It works well, but only 80% of the time.
I am always on-line, but once in a while it hangs for 30 seconds
trying to establish an internet connection.
Either there is something wrong in my method, or maybe I should
poll my connection prior to running the code. Any thoughts.
btw, I have the same logic working perfectly in VB6, using an Inet
control.
good, it then downloads an image from that server(site).
It works well, but only 80% of the time.
I am always on-line, but once in a while it hangs for 30 seconds
trying to establish an internet connection.
Either there is something wrong in my method, or maybe I should
poll my connection prior to running the code. Any thoughts.
btw, I have the same logic working perfectly in VB6, using an Inet
control.
Visual Basic:
Dim sHtml As String
Dim sr As IO.StreamReader
Dim wc As New Net.WebClient()
sr = New IO.StreamReader(wc.OpenRead(m_URL))
sHtml = sr.ReadToEnd
sr.DiscardBufferedData()
sr.Close()
wc.Dispose()
'if the above succeeds then ....
Dim wc As New Net.WebClient()
wc.DownloadFile(URL_IMAGE & sDir & "/" & sName, sName)
wc.Dispose()
SetImageBox(sName)
Last edited: