Hello,
In a VSTO addin for Excel, developed in C#, I am creating a sheet this way:
public void Populate(List<Systems.Models.Producto> productos)
{
Excel.Workbook workbook = _excelApp.ActiveWorkbook;
Excel.Worksheet worksheet = workbook.Sheets.Add(After: workbook.Sheets[workbook.Sheets.Count]);
worksheet.SelectionChange += Worksheet_SelectionChange;
worksheet.Name = "Inventario";
// More instructions
}
Well... I have noticed that Worksheet_SelectionChange is called for a moment when I select any cell in the sheet. After a few minutes later, that event is not called anymore.
At first, I thought that the object that owns the method populate was being disposed. That could sound strange since this object owns the sheet also so that while the sheet is not closed, the object will be alive. However, just in case, I have declared the object that owns the method populate globally to the parent object, but the same problem occurs.
Any help will be appreciated. Thanks
Jaime