I thank you for your responses! After some careful inspection of my code, I
finally sorted out the problem. Here is the working code:
Dim Response As WebResponse
Dim ResponseStream As Stream
Dim Request As WebRequest
Request = WebRequest.Create("http://www.images.image.jpg")
Response = Request.GetResponse
ResponseStream = Response.GetResponseStream
Dim numBytesToRead As Integer = CInt(Response.ContentLength)
Dim bytes(Response.ContentLength) As Byte
Dim numBytesRead As Integer = 0
While numBytesToRead + 1 > 0
Dim n As Integer = ResponseStream.Read(bytes, numBytesRead,
numBytesToRead)
' The end of the file has been reached.
If n = 0 Then
Exit While
End If
numBytesRead += n
numBytesToRead -= n
End While
'Cursor.Current = Cursors.Default
'Response.Close()
Dim b As Bitmap
b = New Bitmap(New MemoryStream(bytes))
Dim fs As New FileStream("myfileB.jpeg", FileMode.Create)
fs.Write(bytes, 0, bytes.Length)
fs.Close()
Cursor.Current = Cursors.Default
Response.Close()
Dim myBitmap As Bitmap
myBitmap = New Bitmap("myfileB.jpeg")
PictureBox1.Image = myBitmap
PictureBox1.Update()
Gigi
"Me" <(E-Mail Removed)> wrote in message
news:JEs3c.56934$(E-Mail Removed)...
> I downloaded a JPG stream from a URI using a WebRequest
>
> Request = WebRequest.Create(http://myWebpage.jpg)
> Response = Request.GetResponse
> ResponseStream = Response.GetResponseStream
>
> I then convert the response to a bitmap file
> PictureBox1.Image = New Bitmap(ResponseStream)
>
> What I would like to do now is to to save the file to the PDA?
>
> Is there any straightforward, easy way to do this in CF?
>
> Thanks,
>
> Gigi
>
>