How can I Programatically download image via .NET CF ?

  • Thread starter Thread starter Me
  • Start date Start date
M

Me

Hello,

I am currently undertaking development for a Pocket PC 2003 PDA using VB.NET
2003.

I have developed a VB.NET application under the .Net Framework that allows
me to programatically download an image from a website and store it on my
local computer.

My problem is that I have not been able to figure out how to do so via the
..Net Compact Framework.

Below is a code snipet of the VB.NET code (NON Compact Framework).

Imports System.Xml
Imports System.Data
Imports System.Net

....
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSearch.Click


Dim strFilename As String
Dim strWebResource As String

strFilename = Application.StartupPath & "\images\" & txtinfo.Text & ".jpg"
txtImageFilename.Text = strFilename
strWebResource = txtImage.Text
DownloadImage(strWebResource, strFilename)
DisplayImage(strFilename)

End Sub

Private Sub DownloadImage(ByVal strWebWebResource As String, ByVal
strFilename As String)

Dim myWebClient As New WebClient

myWebClient.DownloadFile(strWebWebResource, strFilename)

End Sub


Private Sub DisplayImage(ByVal strFilename As String)
picImage.Image = Image.FromFile(strFilename)
picImage.Show()
End Sub

Can anyone tell me how I may accomplish the same in the .NET Compact
Framework?

Thanks,
Me
 
You can create a network stream and then pass the stream into Bitmap's
constructor in order to create a bitmap.

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top