Results 1 to 4 of 4

Thread: What the ****, memorystream question.

  1. #1

    Thread Starter
    Hyperactive Member scuzymoto's Avatar
    Join Date
    Aug 1999
    Location
    Washington State
    Posts
    316

    What the ****, memorystream question.

    Here is my code, the Pos1 - Pos6 objects are Pictureboxes. They all contain pictures that I want to send to a dataset, before I can do that I have to save them to memorystream variables...

    When I run this code I get the following error...

    An unhandled exception of type 'System.ArgumentNullException' occurred in system.drawing.dll

    Additional information: Value cannot be null.

    I don't know what to do because the value of the pictureboxes is definately not null. I can verfiy that through the command window in debug mode. It tells me that it is a valid bitmap object. Any advice would be much appreciated.

    Code:
            Dim Image1 As IO.MemoryStream
            Dim Image2 As IO.MemoryStream
            Dim Image3 As IO.MemoryStream
            Dim Image4 As IO.MemoryStream
            Dim Image5 As IO.MemoryStream
            Dim Image6 As IO.MemoryStream
    
            Pos1.Image.Save(Image1, System.Drawing.Imaging.ImageFormat.Bmp)
            Pos2.Image.Save(Image2, System.Drawing.Imaging.ImageFormat.Bmp)
            Pos3.Image.Save(Image3, System.Drawing.Imaging.ImageFormat.Bmp)
            Pos4.Image.Save(Image4, System.Drawing.Imaging.ImageFormat.Bmp)
            Pos5.Image.Save(Image5, System.Drawing.Imaging.ImageFormat.Bmp)
            Pos6.Image.Save(Image6, System.Drawing.Imaging.ImageFormat.Bmp)
    SCUZ

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hmm. Not sure, but I think you need to change you Dim statement.

    Try Dim ImageX As NEW IO.MemoryStream
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  3. #3

    Thread Starter
    Hyperactive Member scuzymoto's Avatar
    Join Date
    Aug 1999
    Location
    Washington State
    Posts
    316
    Well, that was embarassing. One of those days when you have been working too long to catch the obvious. Thanks for the second set of eyes.
    SCUZ

  4. #4
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    Is there still an issue with late binding like that in VB.net?

    VB6 used to be slower with late binding.

    dim x as thingy = new thingy 'early binding good
    dim x as new thingy 'late binding bad
    I don't live here any more.

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