Reputation: 33
Is there a way to skip certain columns when the tab key/arrow key is pressed?
Suppose I have three columns (col1
,col2
,col3
). Say I was on col1
, I would want to skip col2
when the tab key is pressed.
How can I do this?
Upvotes: 2
Views: 2665
Reputation: 1587
You can do it in CellEnter event.
Try this:
private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "col2")
{
SendKeys.Send("{TAB}");
}
}
Upvotes: 7