Change default image DataGridView Image column C #


Hi good as I indicate in the title what I want is to remove the image with the X, I have not found anything on the Internet that serves me or I can think of anything anyone knows how to change that default image by another that I indicate?

I am referring to the image of the X which is created when a new row is created automatically

asked by Daniel Aparicio 19.07.2018 в 12:33

1 answer



Thanks for making me notice that I had misinterpreted the question, to assign the default value, it would only be enough to assign the image corresponding to the property NullValue

In the case of having a DataGridView that has 2 DataGridViewTextBoxColumn and 1 DataGridViewImageColumn

dataGridView1.Columns[2].DefaultCellStyle.NullValue = Properties.Resources.image01;

Needless to say, it is a property that you can assign before adding the object of type DataGridViewImageColumn to DataGridView in question

DataGridViewImageColumn a = new DataGridViewImageColumn();
a.DefaultCellStyle.NullValue = dataGridView1.Columns[1].DefaultCellStyle.NullValue = Properties.Resources.descarga;

However, it would be interesting to read the DataGridViewImageColumn , so you can apply this more precisely to your problems ..

answered by 19.07.2018 / 13:27