Results 1 to 9 of 9

Thread: Stream to PictureBox: What's wrong? (RESOLVED)

  1. #1

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200

    Question Stream to PictureBox: What's wrong? (RESOLVED)

    VB Code:
    1. Dim myStream As IO.MemoryStream = New IO.MemoryStream()
    2. Dim myByte(myStream.Length) As Byte
    3. myByte = CType(myOleDbDataReader.Item("myImageField"), Byte())
    4. myStream.Write(myByte, 0, myByte.GetUpperBound(0))
    5. PictureBox1.Image.FromStream(myStream)
    The problem is that no image is displayed. I'm sure there is an image in "myImageField".

    What to do?


    Thanks.
    Last edited by AlvaroF1; Oct 27th, 2003 at 08:37 AM.

  2. #2

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200
    Bump.

  3. #3
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    i dont htink u can CType() like that
    \m/\m/

  4. #4

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200
    So, what do you suggest?

  5. #5
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    myOleDbDataReader.Item("myImageField") what is the returning type of that?
    \m/\m/

  6. #6
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  7. #7

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200
    Thank you.

    I did everything that this little tutorial says but still no image is displayed.

    Could you take a look at this code, please?


    Thanks.
    Attached Files Attached Files

  8. #8
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you need to change this line ....
    PictureBox1.Image.FromStream(myStream)
    to this....
    VB Code:
    1. PictureBox1.Image = Image.FromStream(myStream)
    as it's not telling it what the Image equals.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  9. #9

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200
    Oh God...

    Thanx!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width