Click here to Skip to main content
15,662,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, While the users enters into Column_1 or Column_2, I wish to focus to a cell in same row & column_3.
So I tried by the following ways, it's not succeeded...

Thanks for the helps & right directions...

private void myDataGrid1_CellEnter(object sender, DataGridViewCellEventArgs e)
    if (e.RowIndex == 0 && (e.ColumnIndex == 1 || e.ColumnIndex==2 ))
       DataGridViewCell MyCell = myDataGrid1.Rows[myDataGrid1.CurrentCell.RowIndex].Cells[3];
       myDataGrid1.CurrentCell = MyCell;
       myDataGrid1.Rows[myDataGrid1.CurrentCell.RowIndex].Cells[3].Selected = true;

1 solution

I would suspect that you forgot to set appropriate SelectionMode:[^],[^].

You would need to use System.Windows.Forms.DataGridViewSelectionMode.CellSelect.

Share this answer
Paramu1973 4-Dec-13 3:10am    
Alex I Added the Selection mode code, But It's giving "Re-Entrant call to a SetCurrentCellAddress Core function", error...
Sergey Alexandrovich Kryukov 4-Dec-13 3:17am    
Who are you talking to..?
Paramu1973 4-Dec-13 3:45am    
Sergey Alex.., May be I call ur Last Name as Alex...
Sergey Alexandrovich Kryukov 4-Dec-13 9:20am    
None of my names is Alex, on none of its forms. Besides, middle name is only used in combination with first one.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900