C # Add Link column and CheckBox checkbox column in DataGridView ---- 19. 19. Modify and delete student list (P21)

The effect before and after adding is as follows

1 Before adding
Insert picture description here
2. After adding
Insert picture description here

The specific steps are as follows:

1. Right-click the control, select "Edit Column", select Add Column, select DataGridViewLinkColumn, edit the name and text, and click OK
Insert picture description here
2. Add two link columns for deletion and modification
Insert picture description here
3. Modify the NullValue data in DefaultCellStyle for you to add The name of the link column
Insert picture description here
Insert picture description here
4. Add a column of check box type,
Insert picture description here
5. Click the move button to move the check box to the first position
Mr. Zhang
5. This is the final interface
Insert picture description here

This part is to organize the data deletion function that interacts with the database in the DataGridView

Behind the project needs, you need to add a column in the student table of the database. The default value of int is set to 0.
Insert picture description here
This column is automatically generated in the database table.
Insert picture description here
Register the DataGridView event: CellContentClick, click the content in the cell to trigger the event
Insert picture description here

Published 18 original articles · praised 0 · visits 233

Guess you like

Origin blog.csdn.net/qq_39217004/article/details/105364814