private void txt_AccountNumber_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back) { string modifiedAccountNumber = ""; for (int i = 0; i < txt_AccountNumber.Text.Length - 1; i++) { modifiedAccountNumber += txt_AccountNumber.Text[i]; } currentAccountNumber = GeneralFunctions.ApplyAccountFormat(modifiedAccountNumber); } }
private void SearchForGivenAccountNumber() { if (txt_AccountNumber.Text == "" && txt_AccountName.Text == "" && cb_AccountTypeName.Text == "") { GridRefresh(); } else if (txt_AccountNumber.Text != "") { if (txt_AccountNumber.Text.Length <= GeneralFunctions.AccountNumberLenght) { if (GeneralFunctions.CheckSubstring(txt_AccountNumber.Text)) { currentAccountNumber = GeneralFunctions.ApplyAccountFormat(txt_AccountNumber.Text); DataView dv = new DataView(dbAccountingProjectDS.GLAccounts); dv.RowFilter = CreateFilterExpression(); dgv.DataSource = dv; dgv.Refresh(); } else { MessageBox.Show("The Account Number can only contain numeric characters \n Please Insert valid characters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("The lenght of the given account exceeds the lenght of the input account format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (cb_AccountTypeName.Text != "") { DataView dv = new DataView(dbAccountingProjectDS.GLAccounts); dv.RowFilter = CreateFilterExpression(); dgv.DataSource = dv; dgv.Refresh(); } else if (txt_AccountName.Text != "") { DataView dv = new DataView(dbAccountingProjectDS.GLAccounts); dv.RowFilter = CreateFilterExpression(); dgv.DataSource = dv; dgv.Refresh(); } }
private void txt_AccountNumber_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { try { if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back) { string modifiedAccountNumber = ""; for (int i = 0; i < txt_AccountNumber1.Text.Length - 1; i++) { modifiedAccountNumber += txt_AccountNumber1.Text[i]; } currentAccountNumber = GeneralFunctions.ApplyAccountFormat(modifiedAccountNumber); } } catch (Exception ex) { MessageBox.Show(ex.Message, "General Ledger"); } }