<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Retrieve Web Image</Title>
      <Shortcut>RetrieveWebImage</Shortcut>
      <Description>Retrieve Web Image [VB.NET]</Description>
      <Author>Captain Akahige</Author>
      <HelpUrl>/PreviewSnippet.aspx?SnippetID=1ddc3278-2e13-47ec-b801-39c08c345d5d</HelpUrl>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="VB"><![CDATA[    Public Function GetImage(ByVal strURL As String) As Image
        'Requires: 
        '   Imports System.net
        '   Imports System.IO
        'Call:
        '   Using a picture box -
        '   PictureBox1.Image = GetImage(imagesourceURL)
        '   PictureBox1.Image = GetImage("http://www.aintitcool.com/media/konghorn.gif")
        'Possible Uses:
        '   Retrieve and save a timed webcam image - such as the Mount St. Helens Volcano Cam.
        '   Save the image to a file with a timestamp in the file name, then play back.
        Dim objStream As Stream = Nothing
        Dim objRequest As HttpWebRequest = CType(WebRequest.Create(strURL), HttpWebRequest)
        Dim objResponse As HttpWebResponse = CType((objRequest).GetResponse(), HttpWebResponse)
        objStream = objResponse.GetResponseStream()
        Return Image.FromStream(objStream)
    End Function]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>