Yep there is a better way, DataGridViews has a property called 'SelectedRows'. So instead of you looping through every row in the DataGridView you can just use that collection:
vb.net Code:
While Content.SelectedRows.Count > 0 Content.SelectedRows(0).Selected = False End While
Both your code and mine does the same, but I'm just looping through the rows that are selected and making them not selected.![]()




Reply With Quote