Datagridview imagecolumn problem

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
 
C

Cor Ligthert[MVP]

Co

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

Cor
 
C

Cor Ligthert[MVP]

Co

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

Cor
 
C

Co

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
 
C

Co

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top