0
votes

How to move the cursor in a DataGridView? No. .Selected = true; as this puts the cell in blue by default! I want the cursor to move When I click on "Add" button, I want the cursor moves to the last row and last column

i use :

this.dGridView.Rows[nbr].Cells[0].Selected = true;
this.dGridView.BeginEdit(true);

but it doesn't work

thanks for help

1
"it doesn't work" is the worst way you can describe a problem. You get a compiler error? Runtime exception? Unexpected output? What?tnw
I don't have exception or error, but the first cell is selected in blue. i want only the cursor to moveSiwar

1 Answers

0
votes

I'm not sure this will give you what you want, but you can change the selection background and foreground colors to negate the normal, default appearance of a cell being selected. Get the DataGridViewCell Style property. Then change the Style's SelectionBackColor and SelectionForeColor.