Sivaperuman Sivaperuman - 1 month ago 16
C# Question

Disable default cell selection in datagridView

I have DataGridView to load some data programmatically. After inserting my data I am showing the DataGridView . Here by default the 1st row 0th column cell is selected. But I don't need that. I have tried to disable that option.

datagridviewname.currentcell=null


But it will not work. Any body can help me to solve my problem.

Answer

Why u set it null? It should be like following. I think it will work

dataGridViewName.Rows[0].Cells[0].Selected = false;

if it is 1st row 0th, then

dataGridViewName.Rows[1].Cells[0].Selected = false;
Comments