We help IT Professionals succeed at work.

DataGridView deselect row

Hello,

I am using Windows Forms, VS 2010, Windows 7.

I want to programmatically deselect the row in DataGridView. I know for function ClearSelection(), but this function deselets all selected rows. What I want is to deselect just one of the selected rows. Is this possible?


Greetings, Frenky
Comment
Watch Question

Most Valuable Expert 2012
Top Expert 2014
Commented:
Have you tried?

dgv.Rows(index).Selected = False
Check the below option

myDataGrid.UnSelect(myDataGrid.CurrentRowIndex);

MSDN reference
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagrid.unselect.aspx

Author

Commented:
santhimurthyd: your solution is for DataGrid, not for DataGridView.