Today my friend has asked me a good question, he want to ensure the data on the DataGridView is in the correct sorting order. He is wondering how to achieve that. I still remember, I have tried something similar before.
Here it is what you need to do:
- We have a DataGridView called “dgv_Membership“
- This table contains “Surname“, “First Name“, “DoB“, “Screen name“
- We would like to sort the table by DoB (Date Of Birth) before we process that data.
What we need to do it to use the Sort method on the DataGridView control
GridViewName.Sort(“GridViewColumn that you want to sort by”, “Sorting Direction”)