For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Tuesday, July 08, 2014

Sort Datagridview column by button click c#

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);
-------------------------------------------------------------------------------------

"mark" is the cell name in the datagridview.


Share:

0 comments:

Post a Comment

Add Dependent Scripts

   here is the code that allow to add dependent script :         <script>         const addDependentScripts = async function( scriptsT...

Ads Inside Post

Powered by Blogger.

Arsip