3
Answers

Focus On Dgv From Other Controls' KeyDown Event

mahesh waghela

mahesh waghela

12y
1.5k
1

I wants to focus on datagridview's particulars cells on pressing Keys Shift+Tab from textbox1 KeyDown Event like below:

if (e.KeyCode == Keys.Tab && e.Shift) 
{
     
int i = mydgv.Rows.Count - 1;
     mydgv
.CurrentCell = mydgv.Rows[i].Cells[1];
}

But it's not works. I also try mydgv.Rows[i].Cells[1].Selected = true; and textbox1 KeyUp Event but it's not works.

Is there any better way to focus on datagridview's particulars cell from textbox's KeyDown/KeyUp event like above?.


Answers (3)