/// <summary> /// For shortcut keys /// Esc for close /// Ctrl+s for save /// Ctrl+D for delete /// Alt+c for productcreation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmPurchaseReturn_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Escape) { if (PublicVariables.isMessageClose) { Messages.CloseMessage(this); } else { btnClose_Click(sender, e); } } else if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) { cmbCashOrParty.DropDownStyle = (cmbCashOrParty.Focused) ? ComboBoxStyle.DropDown : ComboBoxStyle.DropDownList; btnSave.Focus(); btnSave_Click(sender, e); } else if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) { if (btnDelete.Enabled) { btnDelete_Click(sender, e); } } else if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) { if (dgvPurchaseReturn.CurrentCell != null) { if (dgvPurchaseReturn.CurrentCell == dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductName"] || dgvPurchaseReturn.CurrentCell == dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductCode"]) { if (cmbInvoiceNo.Visible == false) { SendKeys.Send("{F10}"); frmProductCreation frmProductCreationObj = new frmProductCreation(); frmProductCreationObj.MdiParent = formMDI.MDIObj; frmProductCreationObj.CallFromPurcahseReturn(this); } } } } else if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) { if (dgvPurchaseReturn.CurrentCell != null) { if (dgvPurchaseReturn.Columns[dgvPurchaseReturn.CurrentCell.ColumnIndex].Name == "dgvtxtproductName" || dgvPurchaseReturn.Columns[dgvPurchaseReturn.CurrentCell.ColumnIndex].Name == "dgvtxtproductCode") { if (cmbInvoiceNo.Visible == false) { SendKeys.Send("{F10}"); frmProductSearchPopup frmProductSearchPopupObj = new frmProductSearchPopup(); frmProductSearchPopupObj.MdiParent = formMDI.MDIObj; if (dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductName"].Value != null || dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductCode"].Value != null) { frmProductSearchPopupObj.CallFromPurchaseReturn(this, dgvPurchaseReturn.CurrentRow.Index, dgvPurchaseReturn.CurrentRow.Cells["dgvtxtproductCode"].Value.ToString()); } else { frmProductSearchPopupObj.CallFromPurchaseReturn(this, dgvPurchaseReturn.CurrentRow.Index, string.Empty); } } } } } } catch (Exception ex) { MessageBox.Show("PR:102" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }