Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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).

C#
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("Invalid Path");
                }
            }


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

Please help me.

Thanks in advance.

Ankit Agarwal
Software Engineer
Posted
Updated 1-Dec-13 22:57pm
v2

1 solution

Hi,

This should be easy: Use DataGridViewImageColumn as column type.

Btw. Always good to have the MSDN-Site at hand... e.g http://msdn.microsoft.com/de-de/library/2ab8kd75(v=vs.110).aspx[^]
 
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