Solved

Adding Image To Data Grid View Using Image List

Posted on 2009-05-05
2
2,360 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:yuvaratna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 15

Expert Comment

by:JackOfPH
ID: 24311239
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...

0
 
LVL 15

Accepted Solution

by:
JackOfPH earned 500 total points
ID: 24311242
So, in your code it should be something like this:

Dim dgImage As New DataGridViewImageColumn
            dgImage.HeaderText = "Delete"
            dgImage.Image = imagelist1.image(0) 'retrieve the first image in the imagelist.
            dgImage.ImageLayout = DataGridViewImageCellLayout.Normal
         
         TravelGridview.Columns.Insert(5, dgImage)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question