hello all
In a cells of a datagridview I place a gif image name new.gif .

I can show it immediately after the the form load even

I try to print this datagridview cell(0,0) value which is an image name new gif:

Object imgobj= dataGridView1.Rows[0].Cells[0].Value;

but then I do not know how to change this imgobj to something which can be printed
and the printed result show the "new.gif" image
hope someone teach me please

thank you

Why you dont get the image directly out of the cell? You dont need to parse it to object.


public Form1()
            //creating image column:
            DataGridViewImageColumn imageColumn = new DataGridViewImageColumn();
                imageColumn.Name = "colImages";
                imageColumn.HeaderText = "Images";
                imageColumn.Width = 100;
                imageColumn.ImageLayout = DataGridViewImageCellLayout.Normal;
                imageColumn.CellTemplate = new DataGridViewImageCell(false);
                imageColumn.DefaultCellStyle.NullValue = null;
            //adding column to dgv:

            //adding one image to cell of dgv:
            Image pic= Image.FromFile(@"C:\1\backward.png");
            dataGridView1[0, 0].Value = pic;

        private void button1_Click(object sender, EventArgs e)
            //retreiving image form dgv:
            Image img = (Image)dataGridView1[0, 0].Value;

Edited 5 Years Ago by Mitja Bonca: n/a

This question has already been answered. Start a new discussion instead.