cancel
Showing results for 
Search instead for 
Did you mean: 

Add image in a column grid or matrix

Former Member
0 Kudos

Hi All,

I have created a matrix with a column type Picture box and I was trying to add a image (.gif, .bmp, .png) to this particular column

((SAPbouiCOM.PictureBox)matrix.Columns.Item("V_5").Cells.Item(i).Specific).Picture = Environment.CurrentDirectory + "\\1.bmp";

The code is not working and the column is empty.

I just wanted to confirm if this is supported by SDK or do I need to do something else?

Cheers

David

Accepted Solutions (0)

Answers (1)

Answers (1)

pedro_magueija
Active Contributor
0 Kudos

Hi David,

Is the column bound?

Here is a sample:

Form f = B1Connections.theAppl.Forms.Add("test", BoFormTypes.ft_Sizable, 999);

f.Width = 500;

f.Height = 500;

f.Top = 100;

f.Left = 50;

Item i = f.Items.Add("matrix", BoFormItemTypes.it_MATRIX);

i.Width = 498;

i.Height = 498;

Matrix m = i.Specific as Matrix;

DataTable dt = f.DataSources.DataTables.Add("data");

m.Columns.Add("#", BoFormItemTypes.it_EDIT);

m.Columns.Add("name", BoFormItemTypes.it_EDIT);

m.Columns.Add("pic", BoFormItemTypes.it_PICTURE);

dt.Clear();

dt.Columns.Add("name", BoFieldsType.ft_AlphaNumeric, 254);

dt.Columns.Add("pic", BoFieldsType.ft_AlphaNumeric, 254);

m.Columns.Item("name").DataBind.Bind("data", "name");

m.Columns.Item("pic").DataBind.Bind("data", "pic");

dt.Rows.Add();

dt.SetValue("name", 0, @"C:\Chrysanthemum.jpg");

dt.SetValue("pic", 0, @"C:\Chrysanthemum.jpg");

m.LoadFromDataSource();

f.Visible = true;

Good luck.

Best regards,

Pedro Magueija