How to add edit and delete button in datagridview in c#
Finaly, you can add a CellContentClick event handler to DataGridView that allows you to check the column name you click
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
//Check deleted rows
if (dataGridView.Columns[e.ColumnIndex].Name == "Delete")
{
if (MessageBox.Show("Are you sure want to delete this record ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
customersBindingSource.RemoveCurrent();
}
}
tham khảo tại đây.