creat image from stream.

D

David

I have a bimap picuture saved in an access file. the table column type is
OLE object. In VB.Net I am trying to load this image and show it on the
form. I use following code.

Dim pitbyte() As Byte

pitbyte = drCurrent("pic")

Debug.WriteLine(drCurrent("pic"))

Dim ms As MemoryStream = New MemoryStream(pitbyte)

Dim streamedBitmap As Bitmap



streamedBitmap = Bitmap.FromStream(ms) '******** this line cause problem



Me.methodpic.Image = streamedBitmap

then"An unhandled exception of type 'System.ArgumentException' occurred in
system.drawing.dll

Additional information: Invalid parameter used."

Could anybody tell me why I get Invalid parameter used exception?
 
C

Cor Ligthert

David,

No guarantees, however you can try this one.
\\\
Dim ms As MemoryStream = New MemoryStream(pitbyte, 78, pitbyte.Length-78)
///
I hope this helps?

Cor
 
C

Cor Ligthert

David,

AFAIK It seems that there are 2 Ole formats and a normal format of a blob.
You used the normal and 1 of the OLe's now, I do not know the thirth

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top