Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Get Image from embedded resource

Get Image from embedded resource

Scheduled Pinned Locked Moved Visual Basic
hardwarehelptutoriallearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gwittlock
    wrote on last edited by
    #1

    I am using the following code to get an image from a file.

    Using stream As New FileStream(sImageFilename, FileMode.Open, FileAccess.Read)
    Dim img As Image = Image.FromStream(stream)

    End Using

    Now what I would like to do instead is get the Image from my Resource file. I think I need to use MemoryStream but I am not sure how to use it. Any help is greatly appreciated.

    I 1 Reply Last reply
    0
    • G gwittlock

      I am using the following code to get an image from a file.

      Using stream As New FileStream(sImageFilename, FileMode.Open, FileAccess.Read)
      Dim img As Image = Image.FromStream(stream)

      End Using

      Now what I would like to do instead is get the Image from my Resource file. I think I need to use MemoryStream but I am not sure how to use it. Any help is greatly appreciated.

      I Offline
      I Offline
      iProgramIt
      wrote on last edited by
      #2

      So it is embedded in my.resources? Okay, you could extract the image (

      My.Computer.FileSystem.WriteAllBytes(PathToExtract, My.Resources.ImageA, False)

      ) Then, what you can do is get the image and set it in a picturebox etc.

      PictureBox1.Image = Image.FromFile(FileLocation)

      G 1 Reply Last reply
      0
      • I iProgramIt

        So it is embedded in my.resources? Okay, you could extract the image (

        My.Computer.FileSystem.WriteAllBytes(PathToExtract, My.Resources.ImageA, False)

        ) Then, what you can do is get the image and set it in a picturebox etc.

        PictureBox1.Image = Image.FromFile(FileLocation)

        G Offline
        G Offline
        gwittlock
        wrote on last edited by
        #3

        IProgramIt Thank you for the suggestion. I will give it a whirl and see what happens.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups