Link to home
Start Free TrialLog in
Avatar of alfardan
alfardanFlag for United Arab Emirates

asked on

Displaying an Image in a DataGridView Cell

Hi

How can I add an image to a datagridview cell (rows section, not header)? I tried the following code but I got the attached datagridview which is now what I want:

            Dim img_down As New DataGridViewImageCell()
            Dim inImg As Image = Image.FromFile(IO.Directory.GetCurrentDirectory() + "\AppImages\down_arrow.jpg")
            img_down.Value = inImg

            AppListOrderGridView.Columns.Add("MoveDown", "")
            AppListOrderGridView.Columns.Add("Value", "")
            AppListOrderGridView.Columns.Add("ApplNum", "No.")
            AppListOrderGridView.Columns.Add("Priority", "Priority")
            AppListOrderGridView.Columns.Add("ApplName", "Application Name")


            For i = 0 To ApplicationList.Tables(0).Rows.Count - 1
                AppListOrderGridView.Rows.Add(img_down, "Up", (i + 1), "P", ApplicationList.Tables(0).Rows(i).Item("Appname"))
            Next

Open in new window

grid.png
ASKER CERTIFIED SOLUTION
Avatar of Rimvis
Rimvis
Flag of Lithuania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alfardan

ASKER

Perfect, got it working now... thank you