private void dataGridView1_KeyUp(object sender, KeyEventArgs e) { try { dataGridView1.Refresh(); int Secondrowindex = Convert.ToInt32(dataGridView1.CurrentRow.Index); int rowcounter = dataGridView1.Rows.Count; int asd = Convert.ToInt32(dataGridView1.CurrentCell.ColumnIndex); if (asd <= 5 && Secondrowindex == rowcounter - 1) { if (e.KeyCode == Keys.Enter) { if (asd == 5) { dataGridView1.CurrentCell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex - 4, dataGridView1.CurrentRow.Index]; } else if (asd == null) { } else { string asew= dataGridView1.EditMode.ToString(); Console.WriteLine(dataGridView1.CurrentCell.EditedFormattedValue); dataGridView1.CurrentCell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex + 1, dataGridView1.CurrentRow.Index]; } } } else if (asd == 5 && rowcounter == Secondrowindex + 1) { if (e.KeyCode == Keys.Enter) { dataGridView1.CurrentCell = dataGridView1[dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex + 1]; } } else { } } catch (Exception gf) { Console.WriteLine(gf.StackTrace); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)