General discussion

  • Creator
  • #2259193

    “Invalid Parameter Used” Error


    by soundbomber ·

    I am trying to read images from a SQL database by utilising the memorystream class. However, whenever I try to create a Bitmap object from the stream I get the above error. The database records are generally created from .bmp files and the byte object (b) is being created no problems. I have a feeling it has something to do with the bitmap header? I have tried various offsets (78 seems popular on posts) but to no avail. Here is my code:

    b = CType(oPicture, Byte())
    ‘Open a stream and read in the Image
    Dim ms As New System.IO.MemoryStream(b)
    ms.Read(b, iOffset, b.Length – iOffset)
    ‘Create Bitmap from Stream
    bm = New Bitmap(ms) *Error occurs here*

    Can anyone offer any suggestions?

    Thanks in advance

All Comments

  • Author
    • #3282316

      Reply To: “Invalid Parameter Used” Error

      by tony hopkinson ·

      In reply to “Invalid Parameter Used” Error

      From what I could find, it’s saying it doesn’t recognise as a valid parameter.

      All the examples I could find were .net and the parameter was of type Stream.

Viewing 0 reply threads