cancel
Showing results for 
Search instead for 
Did you mean: 

Link picturebox control to datasource

Former Member
0 Kudos

Hello,

I want to store images in a image user field.

Somebody knows how to link a picturebox to a General/Image user field, because there is not specific image data type in BoDataType collection:

oUserDataSource = oUserForm.DataSources.UserDataSources.Add("rgto1",BoDataType.???

Thanks

Blas Gonzalez

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Blas,

There is no data type as PICTURE, and what you need to do is to set the value of your binded datasource to the path of the picture.

Here is an example of binding the picture to a column of

Set oColumn = oColumns.Add("PICTURE", it_PICTURE)
    oColumn.TitleObject.Caption = "PICTURE"
    oColumn.Width = 200
    oColumn.Editable = False

'// Add a user data source
matrix.
oForm.DataSources.UserDataSources.Add "PICTURE", dt_LONG_TEXT, 500

'// bindidng the data
Set oColumn = oColumns.Item("PICTURE")
    
oColumn.DataBind.SetBound True, "", "PICTURE"

'// setting the user data source data
Set oUserDataSource = oForm.DataSources.UserDataSources.Item("PICTURE")
    oUserDataSource.Value = App.Path & "aaaa.JPG"

Hope this helps,

Nick He

Answers (1)

Answers (1)

rasmuswulff_jensen
Active Contributor
0 Kudos

You need to use a DBDatasource... not a userdatasource...


//Create dbds

//Create item
Item i = form.Items.Add("ItemUID",BoFormItemTypes.it_PICTURE);
i.Width = Width;
i.Height = Height;
PictureBox pb = (PictureBox)i.Specific;
pb.DataBind.SetBound(true,"TABEL","FIELD");

If do not have a dbds you don't need a userdatasource


Item i = form.Items.Add("ItemUID",BoFormItemTypes.it_PICTURE);
i.Width = Width;
i.Height = Height;
PictureBox pb = (PictureBox)i.Specific;
pb.Picture = "PicturePath.jpg";