Create datatable with an Image

T

Tina

I need to create a datatable, in code, and put images into it (gifs and
jpg). I use code similar to that below to create the table but I'm not sure
how to get the image into the table....


dim mytable as new datatable
mytable.TableName = "ImageTable"
dim cols as DataColumnCollection
cols = mytable.columns
dim FileName as DataColumn
FileName = cols.Add("FileName", GetType(string))
dim FileImage as DataColumn
FileImage = cols.add("FileImage", GetType(image))

dim myrow as datarow
myrow = mytable.NewRow()
myrow("FileName") = "this is my Pic"
myrow("FileImage") = ..................

if my image is at c:\myPic.jpg, how do I get the image into
myrow("FileImage") ??

thanks,
T
 
G

GaryDean

Tina,
this should do it...

dim myImage as new system.drawing.bitmap("c:\myPic.jpg")
myrow("FileImage") = myImage
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top