Home Forums WinForms controls Xceed Grid for WinForms Double click event handler inactive when datasource changed Reply To: Double click event handler inactive when datasource changed

User (Old forums)
Member
Post count: 23064

The problem is: if you change the DataSource, all the rows and cells in the grid are deleted and created again. That means that all the events for the rows and cells are gone.
However, since you’ve added the handlers to the cells of the DataRowTemplate, they should still work.
Try this:<code>Private Sub formLoad…..
….
AddHandler grid.AddingDataRow, AddressOf addingDataRow
….
End Sub
Private Sub addingDataRow(sender As Object, e As AddingDataRowEventArgs)
Dim row As Xceed.Grid.DataRow = e.DataRow
Dim cell As Xceed.Grid.DataCell
For Each cell In row.Cells
AddHandler cell.DoubleClick, AddressOf updateMenuStatus2
Next
End Sub</code>
This should add the cell doubleclick handler, each time a new datarow is added.

Imported from legacy forums. Posted by Tommy (had 146 views)