1

I have a Janus GridEX and I want to add a DropDownList with images and text to a column. When I populate the ValueList of the column I pass a DataView as parameter which contain a DataTable structured in this way:

var dt = new DataTable("asd");
            dt.Columns.Add("value");
            dt.Columns.Add("text");
            dt.Columns.Add("img", typeof(byte[]));

then I add a row which contains one row:

var row2 = dt.NewRow();
            row2["value"] = 1;
            row2["text"] = "A2";
            row["img"] = GetBytesFromImage(resources.Icon1);

this is the GetBytesFromImage routine:

private byte[] GetBytesFromImage(Icon ico)
{
    using(var ms = new MemoryStream())
    {
        ico.Save(ms);
        return ms.ToArray()
    }
}

then I populate the valuelist:

grid.......PopulateValueList(dataview, "value","text","img",Color.Red, new Size(16,16)

then I get the error. Someone know why?

CRK
  • 337
  • 2
  • 10
  • It pass the byte array of the image.. so how the byte array reference the image? The byte array is not standalone? I think that when you have the byte array of an image you can transform this byte array in that image when you want even outside the program. I'm wrong. – CRK Mar 08 '17 at 13:20

0 Answers0