Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Dear All,

I am using DataGridView control in my windows form. can anybody suggest me how to set ImageList control as a ColoumType to the Coloum of the grid. my requirement is, I have to selet an image from the image combobox in a Grid cell. please suggest me how to atchive this.

Thanks in advance.

Regards,
Anil
Posted
Updated 16-Nov-20 17:00pm

Try
dataGridView1.Rows.Add("Value1", "Value2", imageList1.Images[Index]);

Navigate given article
Images in a Data Grid[^]
 
Share this answer
 
C#
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
    if (e.ColumnIndex == 0)
    {
        e.Value = this.imageList1.Images[(int)e.Value];
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900