/// <summary> /// For shortcut keys /// Esc for formclose /// ctrl+s for Save /// ctrl+d for delete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMaterialReceipt_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Escape) { btnSave.Focus(); dgvProduct.Focus(); btnClose_Click(sender, e); } if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) //Save { btnSave.Focus(); dgvProduct.Focus(); btnSave_Click(sender, e); } if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) //Delete { if (btnDelete.Enabled) { btnSave.Focus(); dgvProduct.Focus(); btnDelete_Click(sender, e); } } if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) //Product Creation { if (dgvProduct.CurrentCell != null) { if (dgvProduct.CurrentCell == dgvProduct.CurrentRow.Cells["dgvtxtProductName"] || dgvProduct.CurrentCell == dgvProduct.CurrentRow.Cells["dgvtxtProductCode"]) { if (dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductName" || dgvProduct.Columns[dgvProduct.CurrentCell.ColumnIndex].Name == "dgvtxtProductCode") { SendKeys.Send("{F10}"); frmProductCreation frmProductCreationObj = new frmProductCreation(); frmProductCreationObj.MdiParent = formMDI.MDIObj; frmProductCreationObj.CallFromMaterialReceipt(this); } } } } } catch (Exception ex) { MessageBox.Show("MR74:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }