How to display different type of images in datagridview multiple existing rows and co

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ankit1984
    New Member
    • Dec 2013
    • 1

    How to display different type of images in datagridview multiple existing rows and co

    Hello,

    I am using this code for display Image in DataGridView but my problem is not being resolved.
    Please help me
    Code:
    private void CreateColumns()
            {
                for (int i = 0; i < dgvDisplayTiles.Rows.Count; i++)
                {
                    dgvDisplayTiles.Rows[i].Cells[3].Value = Image.FromFile(Application.StartupPath + dgvDisplayTiles.Rows[i].Cells[3].Value.ToString());
                    dgvDisplayTiles.Rows[i].Height = 100;
                }    
    
            }
    I am displaying images in DataGridView existing column but it's not displaying.
    My image column DataType is "varchar" in SQL Server, I can't image DataType in SQL server and my image path saved in my image column, I have also image column in DataGridView for image display.
    So, I want to display image in DataGridView existing column,
    Please send me the correct suggestion or code.

    Thanks in Advance.

    Ankit Agarwal
    Software Engineer
    Last edited by Frinavale; Dec 10 '13, 06:53 PM. Reason: Added Code Tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    So you are storing the path to the image in your Database?

    Are you using the DataGridViewIma geColumn?

    Have you tried to read the files in using the controls available to you in the System.IO namespace?


    -Frinny

    (PS If you want to store the image itself pick type VarBinary DataType or something similar)

    Comment

    Working...