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
denny

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

Example:

public Form1()
        {
            InitializeComponent();
            //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:
            dataGridView1.Columns.Add(imageColumn);

            //adding one image to cell of dgv:
            dataGridView1.Rows.Add();
            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;
        }

hello Mitja

Thank you,it's work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.