private void frmCashReceiptVoucher_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F6) { ClearFeilds(); } else if (e.KeyCode == Keys.F3) { if (btnAdd.Enabled) { btnAdd.PerformClick(); } else if (btnUpdate.Enabled) { btnUpdate.PerformClick(); } } else if (e.KeyCode == Keys.Enter) { if (!GCDetail.Focus()) { SendKeys.Send("{TAB}"); } } else if (e.KeyCode == Keys.Escape) { this.Close(); } }
private void frmRequisition_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F6) { ClearFeilds(); } else if (e.KeyCode == Keys.F3) { if (btnAdd.Enabled) { btnAdd.PerformClick(); } else if (btnUpdate.Enabled) { btnUpdate.PerformClick(); } } else if (e.KeyCode == Keys.Enter) { if (!GCDetail.Focus()) { SendKeys.Send("{TAB}"); } } else if (e.KeyCode == Keys.F2) { btnSearch.PerformClick(); } }
private bool Validation() { bool result = true; if (dsMain.Tables["VoucherDetail"].Rows.Count == 0) { MessageBox.Show("Detail does not found. Please Enter Voucher Detail", "Detail Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning); result = false; GCDetail.Focus(); return(result); } if (Convert.ToDecimal(txtTotalDebit.Text) != Convert.ToDecimal(txtTotalCredit.Text)) { MessageBox.Show("Detail should be Match. " + Environment.NewLine + " Total Debit Amount & Total Credit Amount must be equal.", "Miss Match Debit Credit", MessageBoxButtons.OK, MessageBoxIcon.Warning); result = false; GCDetail.Focus(); return(result); } if (string.IsNullOrEmpty(this.VoucherType)) { MessageBox.Show("Voucher Type Not Found. " + Environment.NewLine + " Some thing is Invalid condition Current running Form.", "Voucher Type is Mising.", MessageBoxButtons.OK, MessageBoxIcon.Warning); result = false; return(result); } if (dtpVoucher.Value.Date < MainForm.FicalYearStart.Date || dtpVoucher.Value.Date > MainForm.FicalYearEnd.Date) { MessageBox.Show("Invalid Date Selection. Selected Date is Out of Rang of Fical Year", "Invalid Date Selection.", MessageBoxButtons.OK, MessageBoxIcon.Warning); result = false; } return(result); }