/// <summary> /// For enter key and backspace navigation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSalesInvoice_KeyDown(object sender, KeyEventArgs e) { try { int inDgvSalesRowCount = dgvSalesInvoice.Rows.Count; if (e.KeyCode == Keys.Enter) { if (dgvSalesInvoice.CurrentCell == dgvSalesInvoice.Rows[inDgvSalesRowCount - 1].Cells["dgvtxtSalesInvoiceAmount"]) { cmbDrorCr.Focus(); dgvSalesInvoice.ClearSelection(); } } if (e.KeyCode == Keys.Back) { if (dgvSalesInvoice.CurrentCell == dgvSalesInvoice.Rows[0].Cells["dgvtxtSalesInvoiceSlno"]) { if (cmbCurrency.Enabled == false) { cmbSalesMan.Focus(); } else { cmbCurrency.Focus(); } dgvSalesInvoice.ClearSelection(); } } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) { if (dgvSalesInvoice.Columns[dgvSalesInvoice.CurrentCell.ColumnIndex].Name == "dgvtxtSalesInvoiceProductName" || dgvSalesInvoice.Columns[dgvSalesInvoice.CurrentCell.ColumnIndex].Name == "dgvtxtSalesInvoiceProductCode") { frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvSalesInvoice.CurrentRow.Cells["dgvtxtSalesInvoiceProductCode"].Value != null || dgvSalesInvoice.CurrentRow.Cells["dgvtxtSalesInvoiceProductName"].Value != null) { frmProductSearchPopupObj.CallFromSalesInvoice(this, dgvSalesInvoice.CurrentRow.Index, dgvSalesInvoice.CurrentRow.Cells["dgvtxtSalesInvoiceProductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromSalesInvoice(this, dgvSalesInvoice.CurrentRow.Index, string.Empty); } } } } catch (Exception ex) { MessageBox.Show("SI: 143" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }