This article describes the method of implementing 3-step manual construction of DataGridView in C#. Share it for your reference. The details are as follows:
DataView dvCmControlInfo = new DataView(a DataTable);
first step
(); = false ; = dvCmControlInfo; //Binding DataTable, DataSet, DataView, BindingList = ""; //When binding to multi-table data source, write the table name here.
Step 2
DataGridViewTextBoxColumn dtGroup = new DataGridViewTextBoxColumn(); = "group" ; //The name in DataTable represents "group" = "group" ; //The name displayed by the DataGridView title(dtGroup);
Step 3 (The following attributes are determined by the situation and are not necessary to write them)
[0].Width = 30; //Manually set one-piece length[0].SortMode = ; // Cannot be sorted in order = ; //The content in each cell is arranged in the center
I hope this article will be helpful to everyone's C# programming.