Hi i am using WebClient do download a picture/image. The code I am using is:
VB Code:
Dim m1(-1) As Byte Dim url As String = "urlhere" Dim dbyte As New System.Net.WebClient dbyte.Headers.Add("Cookie", CookieString) Dim memstream As New System.IO.MemoryStream m1 = dbyte.DownloadData(url) memstream.Write(m1, 0, m1.Length) PictureBox1.Image = Image.FromStream(memstream) PictureBox1.Size = PictureBox1.Image.Size PictureBox1.Refresh()
If I load up my app, and use this code, it will freeze for about 5-10 seconds and then download the image and display it fine. If I continue using the code it will work fine and download the image normally without freezing.
Can anyone help me stop it from freezing the first time it is used? Thanks




Reply With Quote