/// <summary> /// Esc for escape /// ctrl+s for save /// ctrl+d for delete /// /// alt+c for product creation /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmStockJournal_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Escape) { btnClose_Click(sender, e); } if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) //Save { btnSave.Focus(); btnSave_Click(sender, e); } if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) //Delete { if (btnDelete.Enabled) { btnDelete_Click(sender, e); } } if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) //Product Creation { if (IsdgvConsuption) { if (dgvConsumption.CurrentCell != null) { if (dgvConsumption.CurrentCell == dgvConsumption.CurrentRow.Cells["dgvtxtConsumptionProductName"] || dgvConsumption.CurrentCell == dgvConsumption.CurrentRow.Cells["dgvtxtConsumptionProductCode"]) { SendKeys.Send("{F10}"); if (dgvConsumption.Columns[dgvConsumption.CurrentCell.ColumnIndex].Name == "dgvtxtConsumptionProductName" || dgvConsumption.Columns[dgvConsumption.CurrentCell.ColumnIndex].Name == "dgvtxtConsumptionProductCode") { frmProductCreation frmProductCreationObj = new frmProductCreation(); frmProductCreationObj.MdiParent = formMDI.MDIObj; frmProductCreationObj.CallFromStockJournal(this); } } } } else { if (dgvProduction.CurrentCell != null) { if (dgvProduction.CurrentCell == dgvProduction.CurrentRow.Cells["dgvtxtProductionProductName"] || dgvProduction.CurrentCell == dgvProduction.CurrentRow.Cells["dgvtxtProductionProductCode"]) { SendKeys.Send("{F10}"); if (dgvProduction.Columns[dgvProduction.CurrentCell.ColumnIndex].Name == "dgvtxtProductionProductName" || dgvProduction.Columns[dgvProduction.CurrentCell.ColumnIndex].Name == "dgvtxtProductionProductCode") { frmProductCreation frmProductCreationObj = new frmProductCreation(); frmProductCreationObj.MdiParent = formMDI.MDIObj; frmProductCreationObj.CallFromStockJournal(this); } } } } } } catch (Exception ex) { MessageBox.Show("SJ:79" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }