Ankit Agarwal

Ankit Agarwal

  • NA
  • 379
  • 253.4k

How can we image display in data gridview column in c# .net

Dec 2 2013 4:57 AM
Hello,

I am using this code for display image in datagridview existing column, only "System.Drawing.Bitmap" displayed in my datagridview column.
My image column datatype is varchar(max).

<pre lang="cs">foreach (DataGridViewRow row1 in dgvDisplayTiles.Rows)
            {
                string imgPath;
                imgPath= (Application.StartupPath + row1.Cells[3].Value.ToString());
                Image imageFloorTile = Image.FromFile(imgPath);
                if (imgPath != null)
                {
                    //img.Image=imgPath;
                  row1.Cells[3].Value = imageFloorTile;
                }
                else
                {
                    MessageBox.Show(&quot;Invalid Path&quot;);
                }
            }</pre>

How can we image display in data gridview column in c# .net windows application?

Please help me.

Thanks in advance.

Ankit Agarwal
Software Engineer

Answers (4)