Home Forums WinForms controls Xceed Grid for WinForms RemovingDataRow event Reply To: RemovingDataRow event

User (Old forums)
Post count: 23064

There will be no memory leak as long as the lifespan of the object containing the callback method is longer than the lifespan of the object exposing the event.  That is, if you subscribe to an event on a cell, and the event handler (the callback) is an instance method of the form on which the grid is located, then when deleting the cell, it will not leak since the object exposing the event (the cell) has a shorter lifespan than the object containing the event handler (the form).

BTW, do you really need to subscribe to cell events in the AddingDataRow event?  You can use the DataRowTemplate to do this once, when the grid is first initialized.

e.g. :

foreach( Cell cell in dataRowTemplate1.Cells )


    cell.ValueChanged +=

new EventHandler( cell_ValueChanged );



Imported from legacy forums. Posted by André (had 658 views)