I am working with DataGridViewObject in my Windows form, using VB.NET. I have three columns that need to display icons. But, based on some info from row, that icons will be shown or not. My problem is that image won't change when I change its value. Basically, I define my columns like this:
Dim column1 As DataGridViewImageColumn = New DataGridViewImageColumn()
column1.Image = My.Resources.image1
column1.Width = 30
dw.Columns.Add(column1)
Dim column2 As DataGridViewImageColumn = New DataGridViewImageColumn()
column2.Image = My.Resources.image2
column2.Width = 30
dw.Columns.Add(column2)
Dim column3 As DataGridViewImageColumn = New DataGridViewImageColumn()
column3.Image = My.Resources.image3
column3.Width = 30
dw.Columns.Add(column3)
After the data is filled, I am looping through rows, and if I do not want to show the images in that row, I do:
Dim cell1 As DataGridViewImageCell = row.Cells(9)
Dim cell2 As DataGridViewImageCell = row.Cells(10)
Dim cell3 As DataGridViewImageCell = row.Cells(11)
cell1.Value = Nothing
cell2.Value = Nothing
cell3.Value = Nothing
But, my images stay. Anyone knows what am I missing?