I want to make an inventory program and I need help with how to put an add and a delete button in a column. I want that the delete button deletes the row and when I click the edit button a forms comes up so I can edit the information.

Check the link below to see the image from my program.

To make a button in the column, use the DataGridViewButtonColumn object. Then, you can create an onclick event to handle your editing/deleting.

DataGridViewButtonColumn buttonColumn = 
            new DataGridViewButtonColumn();
        buttonColumn.HeaderText = "Delete/Edit";

I know that code to remove a row is:


Hope that helps.

Now I made an edit button. What is the code so a new form shows up when i click the button and where should I put that code?

Should I put the code inside the code below or somewhere else.

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)