/// <summary> /// From keydown for Showing curresponding popup and create Quick access in Keybord entrys /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmContraVoucher_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Escape) { if (PublicVariables.isMessageClose) { Messages.CloseMessage(this); } else { this.Close(); } } if (dgvContraVoucher.CurrentRow != null) { if (dgvContraVoucher.CurrentCell.ColumnIndex == dgvContraVoucher.Columns["dgvcmbBankorCashAccount"].Index) { if (dgvContraVoucher.CurrentCell == dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"]) { //--------------------For ledger Popup------------------------------------// if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control)//Ledger popup { frmLedgerPopup frmLedgerPopupObj = new frmLedgerPopup(); frmLedgerPopupObj.MdiParent = formMDI.MDIObj; btnSave.Focus(); dgvContraVoucher.Focus(); if (dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value != null && dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value.ToString() != "") { decimal decLedgerIdForPopUp = Convert.ToDecimal(dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value.ToString()); btnSave.Focus(); dgvContraVoucher.Focus(); frmLedgerPopupObj.CallFromContraVoucher(this, decLedgerIdForPopUp, ""); } } } } if (dgvContraVoucher.CurrentCell == dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"]) { if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt)//Ledger creation { SendKeys.Send("{F10}"); if (dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value != null) { strBankOrCashAccount = dgvContraVoucher.CurrentRow.Cells["dgvcmbBankorCashAccount"].Value.ToString(); } else { strBankOrCashAccount = string.Empty; } frmAccountLedgerObj = new frmAccountLedger(); frmAccountLedgerObj.MdiParent = formMDI.MDIObj; frmAccountLedgerObj.CallFromContraVoucher(this, true); } } if (dgvContraVoucher.CurrentCell == dgvContraVoucher.CurrentRow.Cells["dgvcmbCurrency"]) { if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) //Pop Up { frmCurrencyObj = new frmCurrencyDetails(); frmCurrencyObj.MdiParent = formMDI.MDIObj; btnSave.Focus(); dgvContraVoucher.Focus(); if (dgvContraVoucher.CurrentRow.Cells["dgvcmbCurrency"].Value != null && dgvContraVoucher.CurrentRow.Cells["dgvcmbCurrency"].Value.ToString() != "") { btnSave.Focus(); dgvContraVoucher.Focus(); frmCurrencyObj.CallFromContraVoucher(this, Convert.ToDecimal(dgvContraVoucher.CurrentRow.Cells["dgvcmbCurrency"].Value.ToString())); } } } } if (e.KeyCode == Keys.S && Control.ModifierKeys == Keys.Control) //Save { btnSave.Focus(); if (dgvContraVoucher.Columns["dgvcmbBankorCashAccount"].Selected) { btnSave.Select(); } btnSave_Click(sender, e); } if (e.KeyCode == Keys.D && Control.ModifierKeys == Keys.Control) //Delete { if (btnDelete.Enabled) { btnDelete_Click(sender, e); } } } catch (Exception ex) { MessageBox.Show("CV:49" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// For EnterKey and backSpace Navigation and popup open /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmbBankAccount_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { dgvContraVoucher.Focus(); } if (e.KeyCode == Keys.Back) { txtContraVoucherDate.Focus(); txtContraVoucherDate.SelectionStart = 0; txtContraVoucherDate.SelectionLength = 0; } if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control) { if (cmbBankAccount.Focused) { cmbBankAccount.DropDownStyle = ComboBoxStyle.DropDown; } else { cmbBankAccount.DropDownStyle = ComboBoxStyle.DropDownList; } if (cmbBankAccount.SelectedIndex != -1) { frmLedgerPopupObj = new frmLedgerPopup(); frmLedgerPopupObj.MdiParent = formMDI.MDIObj; frmLedgerPopupObj.CallFromContraVoucher(this, Convert.ToDecimal(cmbBankAccount.SelectedValue.ToString()), "CashOrBank"); } else { Messages.InformationMessage("Select any cash or bank account "); } } if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt) { SendKeys.Send("{F10}"); btnBankAccountAdd_Click(sender, e); } } catch (Exception ex) { MessageBox.Show("CV:52" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }