Moving lists or records in DataGridView ​is not quite difficult, all you have to do is to transfer all the data upward and delete the current. I will explain how my code works as you go through.
LINE 1: This is optional because I have to import a file and display it to my DataGridView so I used it.
LINE 4-15 : THE UP BUTTON (The record will go up or it will increment by 1 when you press it)
LINE 4: I declare selRowIndex to get the current row index of the DataGridView.
LINE 6: If the user selects the first record on the list which means the value of selRowIndex = 0, the message box will prompt that the record cannot be moved (LINE 7) because it is first in the list. You can modify the code according to your will, like for example when the user selects the first record on the list the button will be disabled.
LINE 9-12: If selRowIndex is not equal to zero (0) then the selected row will be copied on the above it and delete the selected one (LINE 13).
LINE 14: Here, I set the selected row on the copied cell because when do not put this code, the selected row will be increment by one (1) which means it will go to the next list on the copied cell.
LINE 18-28: THE DOWN BUTTON
The down button is similar to the up, the difference is the value of the selRowIndex. ​Please refer to the code below to know it better.
LINE 4-15 : THE UP BUTTON (The record will go up or it will increment by 1 when you press it)
LINE 4: I declare selRowIndex to get the current row index of the DataGridView.
LINE 6: If the user selects the first record on the list which means the value of selRowIndex = 0, the message box will prompt that the record cannot be moved (LINE 7) because it is first in the list. You can modify the code according to your will, like for example when the user selects the first record on the list the button will be disabled.
LINE 9-12: If selRowIndex is not equal to zero (0) then the selected row will be copied on the above it and delete the selected one (LINE 13).
LINE 14: Here, I set the selected row on the copied cell because when do not put this code, the selected row will be increment by one (1) which means it will go to the next list on the copied cell.
LINE 18-28: THE DOWN BUTTON
The down button is similar to the up, the difference is the value of the selRowIndex. ​Please refer to the code below to know it better.
I hope you an idea to do on how to move the list(s) on the DataGridView in a simple way. If you have a complex or advance way to do it please don't judge mine because I'm just a beginner and I want to share what I have to anyone. Thank you and have a nice day ahead! ?