Datagridview imagecolumn problem

  • Thread starter Thread starter Co
  • Start date Start date
C

Co

Hi All,

I have a DataGridView with two colums. One checkboxcolumn and one
imagecolumn.
I want the imagecolumn to display an image when I click the
checkboxcolumn and make it's value TRUE.
I don't know what event to use. The code I have doesn't work.

Private Sub setDGVImageStatus(ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCellValueEventArgs)

Dim colName As String = DirectCast(sender,
DataGridView).Columns(e.ColumnIndex).Name.ToString

If DirectCast(sender, DataGridView).Rows(e.RowIndex).Cells
("Status").Value.Equals(True) Then
e.Value = ImageList1.Images(0)
End If

End Sub

Private Sub DataGridView1_CellValueNeeded(ByVal sender As Object,
ByVal e As System.Windows.Forms.DataGridViewCellValueEventArgs)
Handles DataGridView1.CellValueNeeded
If e.ColumnIndex = 6 Then setDGVImageStatus(sender, e)
End Sub

Regards
Marco
 
Co

You need the checked change event from the checkbox, not from the
datagridview.
The datagridview stays the same

Cor
 
Co

You need the checked change event from the checkbox, not from the
datagridview.
The datagridview stays the same

Cor
 
Co

You need the  checked change event from the checkbox, not from the
datagridview.
The datagridview stays the same

Cor

I didn't think a column had it's own events.

Marco
 
Co

You need the  checked change event from the checkbox, not from the
datagridview.
The datagridview stays the same

Cor

I didn't think a column had it's own events.

Marco
 
Back
Top