Click her for Section 1: Making DataGridView Column not sortable
In previous section, I have explained about making DataGridView Column not sortable in programmatic way i.e. using codes.
In this post I will be explaining you to make DataGridView Column not sortable using the column property.
#Please refer this section only if you use Visual Studio IDE or any other IDE that supports drag and drop of controls. Visit Section 1 if you use console/commant prompt to run the GUI.
Requirement: GUI form with DataGridView containing atleast one column
#Here I have used Visual Studio 2010 to design the GUI
#You can resize the DataGridView according to your will ( how big you need)
In previous section, I have explained about making DataGridView Column not sortable in programmatic way i.e. using codes.
In this post I will be explaining you to make DataGridView Column not sortable using the column property.
#Please refer this section only if you use Visual Studio IDE or any other IDE that supports drag and drop of controls. Visit Section 1 if you use console/commant prompt to run the GUI.
Requirement: GUI form with DataGridView containing atleast one column
#Here I have used Visual Studio 2010 to design the GUI
Do the following Steps now:
1) Go to tool box in left-side/pane ( default) than choose DataGridView from Data section and drag to form.
Fig: 2.1: Selecting DataGridView |
Fig 2.2: DataGridView added in form |
2) To add column in DataGridView: Right Click the DataGridView and select 'Add Columns...'
Fig 2.3: Add Column dialog after clicking 'Add Columns...' |
3) Give Name to Column and specify Type and Header Text of Column
#You can leave the default also. In this tutorial I have used default values
4) Click [Add] button
#You can add as many columns as you want. Here, I have added three columns.
Fig: 2.4: Columns added |
5) Now, Right Click the DataGridView and select 'Edit Columns...'
Fig. 2.5: Edit Column Dialog after clicking 'Edit Columns...' |
6) Select Column in Selected Columns in left pane of dialog that you want to make not sortable.
7) Now, search the 'SortMode' property in Unbound Column Properties in left section.
8) Now, Click the combo-box for options available
Fig 2.6: Selecting the NotSortable mode |
9) Select 'NotSortable' and click [OK] button
Now, your not sortable column is ready
#You can make all columns of DataGridView not sortable form this method.
If you have any queries than leave in the comment(s).