Databinding PictureBox control image property

  • Thread starter Thread starter Rabbit
  • Start date Start date
R

Rabbit

Hi,

Does anyone know how to use databinding to bind your dataset to windows form
PictureBox control? 'cause I don't know how to bind the Image property from
my datatable's string field (called ImagePath), as far as know, i can use
following syntax to bind other controls such as textbox:

Me.txtDesc.DataBindings.Add(New Binding("Text", myDataset,
"tbl_dbTable.strDesc"))

But I can't use similar technique for PictureBox control!
 
Hi Rabbit,

I never did that but thinking about it, when you create first an image using
the memory stream in the databinding format handler, I asume that it should
not be a problem.

Cor
 
Rabbit
The fieldname that you mention (ImagePath) implies that it is not the IMAGE that you are attempting to bind, but the filename? If that is your situation, try binding to the image property to an intermediate image object where you loadfromfile(imagepath).

If you are actually storing the binary image file in the database (btw, this is NOT a "prefered practice") then you should be able to directly bind to the image property.

HTH
Cos
 
Back
Top