G
Guest
Hi all im having a little difficulty with the below code
try
request = System.Net.HttpWebRequest.Create(Me.TextBox1.Text)
response = request.GetResponse()
responseStream = response.GetResponseStream()
bitmap2 = New Bitmap(responseStream)
PictureBox1.Image = bitmap2
response.Close()
Catch ex As System.Net.WebException
Me.Timer1.Enabled = False
MessageBox.Show("There was an error opening the image file.
Check the URL")
end try
I have the following dec's
Dim bitmap2 As Bitmap
Dim responseStream As System.IO.Stream
Dim response As System.Net.WebResponse
Dim request As System.Net.WebRequest
The above works but i get a few errors about unrecognised stuff but it
works. But it ties up the gui so i assumed i could add it to a seperate
thread like:-
Try
Dim thrMyThread As New
System.Threading.Thread(AddressOf updateimage)
thrMyThread.Start()
Catch
End Try
and wrap the first set of code into a sub called updateimage
But it fails with a unknown object type,
If i comment out the threading call and call the code i get no error so
i assume this is a threading issue somewhere.
Assuming i may be way off i am trying to download an image from a
website that changes every 10 seconds. I want to grab this image and
display it in a picturebox.
Im using vs 2005 and cf 2.0 on a wm5 ppc phone ed device (imate jamin)
Cheers
James
try
request = System.Net.HttpWebRequest.Create(Me.TextBox1.Text)
response = request.GetResponse()
responseStream = response.GetResponseStream()
bitmap2 = New Bitmap(responseStream)
PictureBox1.Image = bitmap2
response.Close()
Catch ex As System.Net.WebException
Me.Timer1.Enabled = False
MessageBox.Show("There was an error opening the image file.
Check the URL")
end try
I have the following dec's
Dim bitmap2 As Bitmap
Dim responseStream As System.IO.Stream
Dim response As System.Net.WebResponse
Dim request As System.Net.WebRequest
The above works but i get a few errors about unrecognised stuff but it
works. But it ties up the gui so i assumed i could add it to a seperate
thread like:-
Try
Dim thrMyThread As New
System.Threading.Thread(AddressOf updateimage)
thrMyThread.Start()
Catch
End Try
and wrap the first set of code into a sub called updateimage
But it fails with a unknown object type,
If i comment out the threading call and call the code i get no error so
i assume this is a threading issue somewhere.
Assuming i may be way off i am trying to download an image from a
website that changes every 10 seconds. I want to grab this image and
display it in a picturebox.
Im using vs 2005 and cf 2.0 on a wm5 ppc phone ed device (imate jamin)
Cheers
James