Sort Datagridview column by button click c#
If you have added the random records in your Datagridview C# winform and want to show records by any column on button click then use this:
-------------------------------------------------------------------------------------
dataGridView1.Sort( dataGridView1.Columns[1], ListSortDirection.Ascending);
-------------------------------------------------------------------------------------
OR
-------------------------------------------------------------------------------------
dataGridView1.Sort( dataGridView1.Columns["mark"], ListSortDirection.Ascending);
-------------------------------------------------------------------------------------
If you have added the random records in your Datagridview C# winform and want to show records by any column on button click then use this:
-------------------------------------------------------------------------------------
dataGridView1.Sort(
-------------------------------------------------------------------------------------
OR
-------------------------------------------------------------------------------------
dataGridView1.Sort(
-------------------------------------------------------------------------------------
"mark" is the cell name in the datagridview.
0 comments:
Post a Comment