The properties of the DataGridView that are usually set are as follows:
AllowUserToAddRows
- False
Indicates whether to display the option to add rows to the user, and a blank row below the column header will disappear. Generally let it disappear.
AllowUserToDeleteRows
- False
Indicates whether to allow the user to delete rows from the DataGridView. Generally not allowed.
AllowUserToOrderColumns
- False
Indicates whether manual column repositioning is enabled. Generally not allowed.
AllowUserToResizeColumns
- True
Indicates whether the user can resize the column. Generally allowed.
AllowUserToResizeRows
- False
Indicates whether the user can resize the row. Generally not allowed.
AutoGenerateColumns
-True
Gets or sets a value indicating whether the column is automatically created when the DataSource or DataMember properties are set, true if the column should be created automatically; otherwise, false. The default value is true. If AutoGenerateColumns=true is set, gridview table columns can be automatically generated according to the actual situation of the data source. If it is set to AutoGenerateColumns=flase, then you must manually write the columns collection of gridview controls. Otherwise, even if the data is correctly determined, gridvew will not display anything, because there is no column defined, and it is not automatically allowed to generate columns by itself.
AutoSizeColumnsMode
- Fill
Determines the automatic resizing mode for visible columns.
BorderStyle
- None/FixedSingle/Fixed3D
Border style of DataGridView.
GridColor
- Any
Color of grid lines separating DataGridView cells.
MultiSelect
- False
Indicates whether the user can select multiple cells, rows, or columns of the DataGridView at once.
ReadOnly
- True
Indicates whether the user can edit the cell of the DataGridView control.
RowHeadersVisible
- False
Indicates whether to display columns containing row titles.
SelectionMode
- FullRowSelected
Indicates how to select the cell of the DataGridView.
DataGridView controlColumns
The (Name) property in the property is to name the column of this control, and you can enter any name;
DataPropertyName
It is a column bound to a table in DataSet and must be the same as the name of the column of the table you are calling;
HeaderText
is the title of each column displayed in the DataGridView at runtime.
This is all about this article about commonly used properties of DataGridView controls. I hope it will be helpful to everyone's learning and I hope everyone will support me more.