Image downloading

  • Thread starter Thread starter Justin Champion
  • Start date Start date
J

Justin Champion

Hello does anyone have an example of downloading a picture from a network
connection at run time into a picture box on a client ? I have been looking
at some methods on the Internet, butthey all use functionaluty which is not
availbel to the VB.NET compact framework.

If anyone had any idea of even a method to try this it would be useful, the
server could be written by me or a web server.

Thanks,

Justin.



--
 
Hello Justin,

If you need to download a picture from a web share, here is some sample
code that can give an idea how to do it:

private Bitmap LoadPicture(string url)
{
HttpWebRequest wreq;
HttpWebResponse wresp;
Stream mystream;
Bitmap bmp;

bmp = null;
mystream = null;
wresp = null;
try
{
wreq = (HttpWebRequest)WebRequest.Create(url);
wresp = (HttpWebResponse) wreq.GetResponse();

if ((mystream = wresp.GetResponseStream()) != null)
bmp = new Bitmap(mystream);
}
finally
{
if (mystream != null)
mystream.Close();

if (wresp != null)
wresp.Close();
}

return(bmp);
}

Then you can call the method to get a bitmap:
bitmap =
LoadPicture("http://www.microsoft.com/library/homepage/images/init_windows.g
if");

Hope this helps.
Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Justin Champion" <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| Subject: Image downloading
| Date: Mon, 21 Jun 2004 20:53:02 +0100
| Lines: 30
| Message-ID: <[email protected]>
| X-Trace: news.uni-berlin.de
xDnp276ZT+ns0AEgUdzghAb7DLqHqGaMPMPiOGkqAmk1Dn76tq
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news-ber1.d
fn.de!fu-berlin.de!uni-berlin.de!not-for-mail
| Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.compactframework:55673
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Hello does anyone have an example of downloading a picture from a network
| connection at run time into a picture box on a client ? I have been
looking
| at some methods on the Internet, butthey all use functionaluty which is
not
| availbel to the VB.NET compact framework.
|
| If anyone had any idea of even a method to try this it would be useful,
the
| server could be written by me or a web server.
|
| Thanks,
|
| Justin.
|
|
|
| --
|
----------------------------------------------------------------------------
| --------
| "There's no point in being grown up if you can't be childish sometimes"
| Fourth Doctor Who(Tom Baker)
| Doctor Who Web Site www.doctorwho.hopto.org
|
|
|
|
| ---
| Outgoing mail is certified Virus Free.
| Checked by AVG anti-virus system (http://www.grisoft.com).
| Version: 6.0.708 / Virus Database: 464 - Release Date: 18/06/2004
|
|
|
 
thank you I will try this tommorrow when I get access to my machine with
..NET on again.

Justin.

--
----------------------------------------------------------------------------
--------
"There's no point in being grown up if you can't be childish sometimes"
Fourth Doctor Who(Tom Baker)
Doctor Who Web Site www.doctorwho.hopto.org
 
Back
Top