Ejemplo n.º 1
0
        /// <summary>
        /// For enterkey and backspace navigation
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbSalesAccount_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (cmbCurrency.Enabled)
                    {
                        cmbCurrency.Focus();
                    }
                    else
                    {
                        dgvSalesReturn.Focus();
                    }
                }
                if (e.KeyCode == Keys.Back)
                {
                    if (cmbPricingLevel.Enabled)
                    {
                        cmbPricingLevel.Focus();
                    }
                    else if (cmbInvoiceNo.Enabled)
                    {
                        cmbInvoiceNo.Focus();
                    }
                    else if (cmbVoucherType.Enabled)
                    {
                        cmbVoucherType.Focus();
                    }
                    else if (cmbSalesMan.Enabled)
                    {
                        cmbSalesMan.Focus();
                    }
                    else if (cmbCashOrParty.Enabled)
                    {
                        cmbCashOrParty.Focus();
                    }
                    else if (!txtDate.ReadOnly)
                    {
                        txtDate.Focus();
                        txtDate.SelectionStart = 0;
                        txtDate.SelectionLength = 0;
                    }
                    else if (!txtReturnNo.ReadOnly)
                    {
                        txtReturnNo.Focus();
                    }
                }
                if (e.KeyCode == Keys.F && Control.ModifierKeys == Keys.Control)
                {
                    SendKeys.Send("{F10}");
                    if (cmbSalesAccount.Focused)
                    {
                        cmbSalesAccount.DropDownStyle = ComboBoxStyle.DropDown;
                    }
                    else
                    {
                        cmbSalesAccount.DropDownStyle = ComboBoxStyle.DropDownList;
                    }
                    if (cmbSalesAccount.SelectedIndex != -1)
                    {
                        frmLedgerPopup frmLedgerPopupObj = new frmLedgerPopup();
                        frmLedgerPopupObj.MdiParent = formMDI.MDIObj;
                        frmLedgerPopupObj.CallFromSalesReturn(this, Convert.ToDecimal(cmbSalesAccount.SelectedValue.ToString()), "SalesAccountLedger");
                    }
                    else
                    {
                        Messages.InformationMessage("Select any sales account");
                    }
                }
                if (e.KeyCode == Keys.C && Control.ModifierKeys == Keys.Alt)
                {
                    SendKeys.Send("{F10}");

                    btnSalesAcct_Click(sender, e);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("SR112:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }