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. C#
  4. Displaying a picture

Displaying a picture

Scheduled Pinned Locked Moved C#
databasehelpquestion
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.
  • I Offline
    I Offline
    Icarus123
    wrote on last edited by
    #1

    Hi there. I have loaded a picture into a DB. Now when i take it out again, I save it as a Byte[] variable. What i want to do, is to use that Byte[] variable with the information and display it in an imageBox. Can anyone help me with this? Thanks

    X 1 Reply Last reply
    0
    • I Icarus123

      Hi there. I have loaded a picture into a DB. Now when i take it out again, I save it as a Byte[] variable. What i want to do, is to use that Byte[] variable with the information and display it in an imageBox. Can anyone help me with this? Thanks

      X Offline
      X Offline
      xibeifeijian
      wrote on last edited by
      #2

      Save the byte array to a stream.Then use Image.FromStream(ms) to create a Image object. MemoryStream ms=new MemoryStream(bytes); Image img=Image.FromStream(ms);

      :^):^):^):^):^):^):^):^):^):^):^):^) :^):rose::rose::rose::rose::rose:▒▒〓▒〓▒▒ :^):rose::^):^):^):^)▒〓〓〓〓〓▒ :^):rose::^):^):^):^)▒▒〓▒〓▒▒ :^):rose::^):^):^):^)▒〓〓〓〓〓▒ :^):rose::rose::rose::rose::rose:▒▒〓▒〓▒▒ :^):^):^):^):^):^):^):^):^):^):^):^)

      I 1 Reply Last reply
      0
      • X xibeifeijian

        Save the byte array to a stream.Then use Image.FromStream(ms) to create a Image object. MemoryStream ms=new MemoryStream(bytes); Image img=Image.FromStream(ms);

        :^):^):^):^):^):^):^):^):^):^):^):^) :^):rose::rose::rose::rose::rose:▒▒〓▒〓▒▒ :^):rose::^):^):^):^)▒〓〓〓〓〓▒ :^):rose::^):^):^):^)▒▒〓▒〓▒▒ :^):rose::^):^):^):^)▒〓〓〓〓〓▒ :^):rose::rose::rose::rose::rose:▒▒〓▒〓▒▒ :^):^):^):^):^):^):^):^):^):^):^):^)

        I Offline
        I Offline
        Icarus123
        wrote on last edited by
        #3

        Thanks, it works. But do you how i can use that Image in an imagebox? i am getting a cannot implicitle convert type 'System.Drawing.Image' to 'System.web.UI.Webcontrol.Image'

        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