Click here to Skip to main content
15,795,793 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a DataGridview In When I Sorting at any column I want to Keep the First row before Sorting the first row After sorting too And the same thing for the last row[^]

What I have tried:

I tried to Copy this data after sorting to a new DT after that I Deleted the Original First row and the last row then I inserted it again then I filled the Datatgridview again from the new table .. But it's now working with me
Updated 1-Jun-23 4:19am
Member 15627495 1-Jun-23 8:25am    
you can copy the row(0) in an object 'datagridviewrow',
and insert that saved row as first item of the datagridview,
then you fill all following elements contained in your dataset.

as you use dataset to load your datas, you have to build the datagrid view content programmaticaly.

but you can interact and modify the dataset too.

the question is "which element from dataset or datagridview will be used to achieve ?"
the decision is yours.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900