C#-WinForm basic knowledge of DatagridView

DatagridView operation

1 Visible property: when it is true, the control is displayed, and when it is false, the control is hidden and will not occupy a position

2 dataGridView1.ReadOnly = true ; Change to read-only;

3 dataGridView1.AllowUserToAddRows = false ; adding rows is not allowed

4 dataGridView1.BackgroundColor = Color.White ; set the background to white

5 dataGridView1.MultiSelect = false ; only allow to select a single row

6 dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; when selected, the entire row is selected

7 CurrentRow : the row where the current cell is located

8 cells[0] OR cells["name"] : The first cell of the current row The column of cells named "name" in the current row

9 SelectedCells : Indicates selected cells

10 Rows : Get all the rows of a collection table

11 SelectedColumns : Get a collection of columns selected by the user

12 SelectedRows : Get a collection of rows selected by the user

13. SelectionMode : Set a value and change the value to indicate how to select the cell

14. RowCount : Get or set the number of rows displayed in the table

15. Columns : Get a collection that contains all the columns in the control

16. ColumnCount : Get or set the number of columns displayed in the table

Guess you like

Origin blog.csdn.net/jsxiaochen/article/details/108731510
Recommended