Link to home
Start Free TrialLog in
Avatar of yuvaratna
yuvaratna

asked on

Adding Image To Data Grid View Using Image List

I want to add an image to the 6th column of the datagrid view..i tried the followinhg snippet..But i dont wanted to Give the path of the computer ..i know that we can ad an im age using image list ...how can i do that!
Dim dgImage As New DataGridViewImageColumn
            dgImage.HeaderText = "Delete"
            dgImage.Image = Drawing.Image.FromFile("C:\....\....\....\delete.gif")
            dgImage.ImageLayout = DataGridViewImageCellLayout.Normal
          
         TravelGridview.Columns.Insert(5, dgImage)

Open in new window

Avatar of JackOfPH
JackOfPH
Flag of Philippines image

Add an image to your form or usercontrol.

Configure the imagelist, add image you want..

Then to retrieve the image in the image list do the following


imagelist1.image(0)   '<--- This will load the first image in the imagelist...

ASKER CERTIFIED SOLUTION
Avatar of JackOfPH
JackOfPH
Flag of Philippines 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