Load Image from Access DB

  • Thread starter Thread starter T Cordon
  • Start date Start date
Hi T,

Dim abyt() As Byte
abyt = CType(ds.Tables(0).Rows(0)(0), Byte())
Dim ms As New IO.MemoryStream(abyt)
Me.PictureBox1.Image = Image.FromStream(ms)

This is all you need.

I hope this helps?

Cor
 
This is the code im using:

Dim bytes() As Byte = CType(g_ADORecordset.Fields("Image").Value,Byte())
Dim imgStream As MemoryStream = New MemoryStream(bytes)
picLarge.Image = Image.FromStream(imgStream)

But I get an error: INVALID PARAMETER USED

In the 3rd line



Thanks
 
Hi T,

I think that it has to do with the OLE object with what it was loaded.

I never had to do with it, this is an article that maybe can help you to extract the pic from the object.

http://google.com/[email protected]

It is only an article. If not you can also ask this in the newsgroup.

microsoft.public.dotnet.drawings

I think you will find the answer there.

Or search the results I had with searching (there where more solutions)

http://tinyurl.com/39bax

However I hope the first link helps already?

Cor
 
* "Cor said:
Dim abyt() As Byte
abyt = CType(ds.Tables(0).Rows(0)(0), Byte())
Dim ms As New IO.MemoryStream(abyt)
Me.PictureBox1.Image = Image.FromStream(ms)

This is all you need.

Notice that the 'MemoryStream' must be kept alive as long as the image
is used.
 
Thanks for your repplies, ill take a look at thos links you posted.

Thanks again

Hi T,

I think that it has to do with the OLE object with what it was loaded.

I never had to do with it, this is an article that maybe can help you to extract the pic from the object.

http://google.com/[email protected]

It is only an article. If not you can also ask this in the newsgroup.

microsoft.public.dotnet.drawings

I think you will find the answer there.

Or search the results I had with searching (there where more solutions)

http://tinyurl.com/39bax

However I hope the first link helps already?

Cor
 
Back
Top