views:

29

answers:

1

I have a custom IBinding List which raises the ListChanged event. I would like to recolor the Datagridview row after the ListChanged event.

The Datagridview is responding to ListChanged event and changes the cell value but the CellValueChanged event is never fired.

What Datagridview event reflects the ListChanged event?

Class CustomList : IBinding

Public Sub UpdateList(Byval index as Integer)
     List(index).Active = true
     RaiseEvent ListChanged(Me, _
        New System.ComponentModel.ListChangedEventArgs _
        (System.ComponentModel.ListChangedType.ItemChanged, index))
End Sub

Class CustomDataGridView : DataGridView

Private Sub Grid_CellValueChanged(ByVal sender As Object, _
            ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
            Handles Me.CellValueChanged
     ColorRow(Rows(e.RowIndex)) ''//NeverFires
End Sub

Class : Form

Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
                Handles Me.Load

        Dim customList As New CustomList()
        customList.add(new CustomItem())
        dgv.DataSource = customList
        customList.UpdateList(0) ''//DatagridView updates but no event is raised

End Sub

Update:

CellValueChanged event only fires when a new value is pushed from the DGV to the DT. Not other way round.

Vivek Apr 5 at 18:52

+1  A: 

Changing the cells background color should be done in the RowPrePaint-Event, this will be fired if the row is repainted, after the value change.

BeowulfOF