When a column button is clicked I wonder how I can get that data for that particular row.
For instance below I would like to get the data for the object of Puppypuppy and pass on the data to a UserControl (which in my case is a simple window that I want to populate with the data from the clicked button)
The code for the event when a button is clicked:
- private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
- {
- var senderGrid = (DataGridView)sender;
-
- if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
- e.RowIndex >= 0)
- {
-
- // UserControlPlayAnimal playAnimals = new UserControlPlayAnimal();
- }
- }