1
votes

I have a Windows Form Application with a DataGridView.

AutoGenerateColumns is false so I have added the columns manually

I left out the ID field from the added columns and added a DataGridViewButtonColumn column.

How do I associate the ID to the row without displaying it so that the Delete button deletes the row it is on?

1
You can leave the ID column in the datagrid and just set it as hidden. That way you'll be able to interact with it but users won't see it. - Forklift
Looks like dgv.Columns["ColumnName"].Visible = false; - Forklift
That seems to have worked. Thanks @Forklift! - toadfromgrove
Cheers, @toad happy to help - Forklift

1 Answers

0
votes

As per @forklift comment. Making the column not visible worked fine.