leathu raj

leathu raj

  • NA
  • 62
  • 79.4k

Enter key focusing in gridview in c#

Nov 14 2014 3:58 AM
hi,
   In my project i need one help. i am using gridview for billing. My grid view like as
   slno   name    rate   qty  amt
 1          pen         10      5      50
 
 
 
Here name field is grid view combobox and collect data from database. And based on this combobox the rate is automatically fill. That coding is working fine. But my error is i want use focus from gridview combobox and using enter key the focus go to qty fied and then pressing enter that focus go to next row gridview combobox as well....
i am using the following code it focus accordingly.
if (e.KeyCode == Keys.Enter)
{
e.SuppressKeyPress = true;
int ic = grid_item.CurrentCell.ColumnIndex;
int ir = grid_item.CurrentCell.RowIndex;
if (ic == grid_item.Columns.Count - 1)
{
grid_item.Rows.Add();
grid_item.CurrentCell = grid_item[1, ir + 1];
}
else
grid_item.CurrentCell = grid_item[4, ir];
}
But when i use enter key  to select item in my combobox the item will select and focus go to next row combobox only it does not go to qty field....
 
Please help me.....
 thank in advance to all.....
Eagerly waiting for answers