Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Images don't display.
 

Images don't display.

Hi:

I'm trying to get a simple image to show up in a DataGridViewImageColumn in a DataGridView.

No matter what I do, all I get is a red X. In the properties window I can see the image justt fine. In the column in the grid, I just get that X.

I started with a jpg and tried converting it to a bitmap. I know the app. can see it because the properties window names it and displays it. If I make it a 'resource', it can see it. Still the column itself cannot see it.

Oh, I also tried setting the image mode to Stretch. It simply can't see the image.

What must I do to get the image to show up? Or is it that the DataGridView simply doesn't display images?

MarlAtkins  Tuesday, August 22, 2006 4:05 PM

Hi,

You may see the red X in the designer time, but after it's compiled and executed, it's ok, showing the image in the run time.

gqlu  Wednesday, August 23, 2006 3:54 AM

Hmm, I tried that and it didn't work.
Should it work for a .jpg file? If so, it didn't work. i got the X at run time as well.

MarlAtkins  Wednesday, August 23, 2006 11:22 PM

Hi,

I tried again, and did the following: Add a new datagridview, edit the columns to add a new DataGridViewImageColumn. And set the Image property of the ImageColumn to some .jpg picture. Compile it and run, it DO NOT show up the image picture. But after I databind the datagridview control, add the following lines,

dataGridView2.AutoGenerateColumns = true;
dataGridView2.DataSource = northwindDS;
dataGridView2.DataMember = "Customers";

, compile and run, it DO show up the image. Have you set the datasource of the datagridview then?

gqlu  Thursday, August 24, 2006 2:02 AM

You can use google to search for other answers

Custom Search

More Threads

• Correct errors in CellValidating event
• Sorting algorithm has a bug ?!?
• [2005] extending the columns that are generated by the dataset designer
• Checkbox as selected in window applictaion datagridview control
• How to duplicate records within the same table?
• DataGridView ComboBoxCell Problem
• DataGridView Rows
• DataGridView KeyPress Event Not Working
• Infopath form fetching data from data server
• Problem with Custom Calender(EditingControl) in Datagridview