mahesh waghela

mahesh waghela

  • NA
  • 32
  • 31.8k

Focus On Dgv From Other Controls' KeyDown Event

May 17 2012 3:17 AM

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)