I am writing the code in datagridview cell enter event as
private void dgvGoodsRecpt_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if (dgvGoodsRecpt.CurrentRow.Cells[e.ColumnIndex].ReadOnly)
{
SendKeys.Send("{tab}");
}
}
This code will send the tab to next cell ,if the current cell is ReadOnly true
.
It is working well but here my problem is that my datagridview last column is readonly true
and the next controls are txtAmount1.Text
and txtAmount2.Text
.
When I keep on pressing Tab key the focus is going to txtAmount2.Text
. But the next to datagridview is txtAmount1.Text
. The focus is going to the next control of the imidiate control after datagridview. The focus supposed to go to the txtAmount1.Text
control. What should I do? Please help me.