private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "Delete")
{
// delete it. first deactivate
deactivate(e.RowIndex);
var wbInfo = Globals.AMPSAddin.getWorkbookInfo(
Globals.AMPSAddin.Application.ActiveWorkbook);
// then remove
wbInfo.Subscriptions.Remove(_subs[e.RowIndex].Name);
// then fix up the subscriptions
for (int i = e.RowIndex; i < dataGridView1.Rows.Count - 1; i++)
{
_subs[i] = _subs[i + 1];
}
_subs[dataGridView1.Rows.Count - 1] = null;
dataGridView1.Rows.RemoveAt(e.RowIndex);
}
}