25 thg 12, 2020

WINDOWS FORMS: HOW TO ADD A BUTTON EACH ROW IN A DATAGRIDVIEW IN C#

 

How to add edit and delete button in datagridview in c#

c# gridview add row button

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.

WINDOWS FORMS: HOW TO ADD A BUTTON EACH ROW IN A DATAGRIDVIEW IN C# Rating: 4.5 Diposkan Oleh: http://pdunoteit.blogspot.com/