Add Button Column in DataGridView
Do the following steps.
Step 1: Click on the dataGridView. You will see an arrow sign on the upper right corner. Click on it.
Step 2:
Step 3:
Set the Name. Here Name is the button's property name. It is not the display text of button.
Set the Type as DataGridViewButtonColumn.
Set the Header text. It shows the column's head name.
Now a button column has been added to the dataGridView. But the text of the button has not set yet. So click on the arrow sign again and select Edit Columns.
Step 5:
On the left side, select the column header you want to edit. We select Edit column to change it's properties. Then set the Text and make UseColumnTextForButton true. Then press OK.
Step 6:
Build and Start your Project. In my database, student table has 3 rows, that's why 3 Update button has been added to dataGridView's Edit column.
To do the button column click event, see this
Comments
Post a Comment