I have a DataGridView with thousands of records that I added programmatically. In this case, there is no data source. Now I want to shuffle the recordings every time I press the button. How can this be achieved?
According to this question, you can use DataGridView.Rows.RemoveAtand DataGridView.Rows.Insertto move rows to an unrelated DataGridView. You can generate a set of random integer indexes to copy, delete, and paste elsewhere in the table to recreate the "shuffle".
DataGridView.Rows.RemoveAt
DataGridView.Rows.Insert
OrderBy (x = > Guid.NewGuid()). Guid . GUID , . , , (, Random (-1, 1)).