I have the dataGridview in c# for Purchase order entry. I want to change the cell Focus from ItemId to NoofQty when I press Enter key after selecting ItemId. Then again press Enter key go to next row ItemId.
Which dataGridview event is suitable for this? Could you please anyone help me..
I have tried as far as I can as below
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
try
{
if(e.ColumnIndex==0)// ItemId
{
dataGridView1.Rows[e.RowIndex].Cells[4].Selected= true;
dataGridView1.Rows[e.RowIndex].Cells[4].Value="1";
//I want to edit this cell value
}
else if (e.ColumnIndex == 4)// ItemId
{
//goto next row and cell is ItemId
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Best Answer
Try this:
OR