I'm trying to delete row by line in DataGridView
, these lines would be in the case files (attachments) without any database connection, only the following error message appears:
It is not possible to programmatically remove rows unless
DataGridView
is associated with data in a% change with support for change notification and allows deletion.
Follow the code below:
private void DataGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 4)
DataGrid1.Rows.RemoveAt(DataGrid1.CurrentRow.Index);
}