private void m_dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex != 0 || e.RowIndex < 0 || e.RowIndex >= m_dataGridView.RowCount) { return; } var row = m_dataGridView.Rows[e.RowIndex]; var vm = row.Tag as VM; if (vm != null) { if ((bool)row.Cells[0].Value) { if (!VMsToExport.Contains(vm)) { VMsToExport.Add(vm); } } else { VMsToExport.Remove(vm); } } m_ctrlError.HideError(); UpdateCounterLabel(); IsDirty = true; EnableButtons(); }
private void m_buttonClearAll_Click(object sender, EventArgs e) { //clear all visible ones foreach (DataGridViewRow dataGridViewRow in m_dataGridView.Rows) { dataGridViewRow.Cells[0].Value = false; if (dataGridViewRow.Tag is VM vm) { VMsToExport.Remove(vm); } } }