Hi,
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.
http://img534.imageshack.us/img534/5181/inventorysss.jpg

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:

DataGridView1.Rows.RemoveAt(index)

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)
        {

        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.